Skip to content

Commit

Permalink
fix indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
NorbertBodziony committed Sep 12, 2024
1 parent 2e1e0ef commit 0df29d6
Show file tree
Hide file tree
Showing 16 changed files with 9,302 additions and 3,030 deletions.
4,865 changes: 1,914 additions & 2,951 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ members = [
"crates/shared-crypto",
"crates/simulacrum",
"crates/sui",
"crates/sui-adapter-transactional-tests",
"crates/sui-analytics-indexer",
"crates/sui-analytics-indexer-derive",
# "crates/sui-adapter-transactional-tests",
# "crates/sui-analytics-indexer",
# "crates/sui-analytics-indexer-derive",
"crates/sui-archival",
"crates/sui-authority-aggregation",
"crates/sui-aws-orchestrator",
"crates/sui-benchmark",
"crates/sui-bridge",
"crates/sui-bridge-cli",
"crates/sui-bridge-indexer",
"crates/sui-cluster-test",
# "crates/sui-cluster-test",
"crates/sui-config",
"crates/sui-core",
"crates/sui-cost",
Expand All @@ -106,11 +106,11 @@ members = [
"crates/sui-framework-snapshot",
"crates/sui-framework-tests",
"crates/sui-genesis-builder",
"crates/sui-graphql-config",
"crates/sui-graphql-e2e-tests",
"crates/sui-graphql-rpc",
"crates/sui-graphql-rpc-client",
"crates/sui-graphql-rpc-headers",
# "crates/sui-graphql-config",
# "crates/sui-graphql-e2e-tests",
# "crates/sui-graphql-rpc",
# "crates/sui-graphql-rpc-client",
# "crates/sui-graphql-rpc-headers",
"crates/sui-indexer",
"crates/sui-indexer-builder",
"crates/sui-json",
Expand Down Expand Up @@ -159,7 +159,7 @@ members = [
"crates/sui-tool",
"crates/sui-transaction-builder",
"crates/sui-transaction-checks",
"crates/sui-transactional-test-runner",
# "crates/sui-transactional-test-runner",
"crates/sui-types",
"crates/sui-upgrade-compatibility-transactional-tests",
"crates/sui-verifier-transactional-tests",
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-adapter-transactional-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"

[dev-dependencies]
datatest-stable.workspace = true
sui-transactional-test-runner.workspace = true
# sui-transactional-test-runner.workspace = true

[[test]]
name = "tests"
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-analytics-indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ parquet.workspace = true
arrow-array.workspace = true
fastcrypto = { workspace = true, features = ["copy_key"] }
mysten-metrics.workspace = true
sui-analytics-indexer-derive.workspace = true
# sui-analytics-indexer-derive.workspace = true
sui-data-ingestion-core.workspace = true
sui-indexer.workspace = true
eyre.workspace = true
Expand All @@ -51,7 +51,7 @@ sui-json-rpc-types.workspace = true
sui-package-resolver.workspace = true
simulacrum.workspace = true
arrow.workspace = true
gcp-bigquery-client = "0.18.0"
# gcp-bigquery-client = "0.18.0"
snowflake-api.workspace = true
tap.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion crates/sui-cluster-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ regex.workspace = true

sui-indexer.workspace = true
sui-faucet.workspace = true
sui-graphql-rpc.workspace = true
# sui-graphql-rpc.workspace = true
sui-swarm.workspace = true
sui-swarm-config.workspace = true
sui-json-rpc-types.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-graphql-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ im.workspace = true
downcast = "0.11.0"

sui-graphql-config.workspace = true
sui-graphql-rpc-headers.workspace = true
sui-graphql-rpc-client.workspace = true
# sui-graphql-rpc-headers.workspace = true
# sui-graphql-rpc-client.workspace = true


# TODO: put these behind feature flag to prevent leakage
Expand Down
5,000 changes: 5,000 additions & 0 deletions crates/sui-indexer/logs.txt

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions crates/sui-indexer/src/handlers/checkpoint_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ use std::collections::{BTreeMap, HashMap};
use std::sync::{Arc, Mutex};

use async_trait::async_trait;
use chrono::Utc;
use diesel::r2d2::R2D2Connection;
use itertools::Itertools;
use odin::structs::sui_notifications::{
CoinReceived, CoinSent, CoinSwap, NftBurned, NftMinted, NftReceived, NftSent,
SuiIndexerNotification,
};
use odin::sui_ws::{
AccountObjectsUpdate, CoinCreated, CoinMutated, CoinObjectUpdateStatus, ObjectChangeUpdate,
ObjectUpdateStatus, SuiWsApiMsg, TokenBalanceUpdate, TokenUpdate,
};
use sui_types::gas_coin::GAS;
use tap::tap::TapFallible;
use tokio::sync::watch;
use tokio_util::sync::CancellationToken;
use tracing::{info, warn};
use tracing::{error, info, warn};

use move_core_types::annotated_value::{MoveStructLayout, MoveTypeLayout};
use move_core_types::language_storage::{StructTag, TypeTag};
use mysten_metrics::{get_metrics, spawn_monitored_task};
use sui_data_ingestion_core::Worker;
use sui_json_rpc_types::SuiMoveValue;
use sui_json_rpc_types::{ObjectStatus, SuiMoveValue};
use sui_package_resolver::{PackageStore, PackageStoreWithLruCache, Resolver};
use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_types::base_types::ObjectID;
use sui_types::dynamic_field::DynamicFieldInfo;
use sui_types::dynamic_field::DynamicFieldName;
use sui_types::dynamic_field::DynamicFieldType;
use sui_types::effects::TransactionEffectsAPI;
use sui_types::effects::{TransactionEffects, TransactionEffectsAPI};
use sui_types::event::SystemEpochInfoEvent;
use sui_types::messages_checkpoint::{
CertifiedCheckpointSummary, CheckpointContents, CheckpointSequenceNumber,
Expand All @@ -44,15 +54,16 @@ use crate::models::display::StoredDisplay;
use crate::store::package_resolver::{IndexerStorePackageResolver, InterimPackageResolver};
use crate::store::{IndexerStore, PgIndexerStore};
use crate::types::{
EventIndex, IndexedCheckpoint, IndexedDeletedObject, IndexedEpochInfo, IndexedEvent,
IndexedObject, IndexedPackage, IndexedTransaction, IndexerResult, TransactionKind, TxIndex,
CustomIndexedTransaction, EventIndex, IndexedCheckpoint, IndexedDeletedObject,
IndexedEpochInfo, IndexedEvent, IndexedObject, IndexedPackage, IndexerResult, TransactionKind,
TxIndex,
};

use super::tx_processor::EpochEndIndexingObjectStore;
use super::tx_processor::TxChangesProcessor;
use super::CheckpointDataToCommit;
use super::EpochToCommit;
use super::TransactionObjectChangesToCommit;
use super::{CheckpointDataToCommit, CustomCheckpointDataToCommit};

const CHECKPOINT_QUEUE_SIZE: usize = 100;

Expand Down
4 changes: 2 additions & 2 deletions crates/sui-indexer/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::collections::BTreeMap;
use crate::{
models::display::StoredDisplay,
types::{
EventIndex, IndexedCheckpoint, IndexedDeletedObject, IndexedEpochInfo, IndexedEvent,
IndexedObject, IndexedPackage, IndexedTransaction, TxIndex,
CustomIndexedTransaction, EventIndex, IndexedCheckpoint, IndexedDeletedObject,
IndexedEpochInfo, IndexedEvent, IndexedObject, IndexedPackage, IndexedTransaction, TxIndex,
},
};

Expand Down
1 change: 1 addition & 0 deletions crates/sui-indexer/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl Indexer {
.expect("Failed to get latest tx checkpoint sequence number from DB")
.map(|seq| seq + 1)
.unwrap_or_default();
// let primary_watermark = 56614153;
let download_queue_size = env::var("DOWNLOAD_QUEUE_SIZE")
.unwrap_or_else(|_| DOWNLOAD_QUEUE_SIZE.to_string())
.parse::<usize>()
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-indexer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
#![recursion_limit = "256"]
#![recursion_limit = "512"]

use std::net::SocketAddr;
use std::time::Duration;
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-indexer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ async fn main() -> Result<(), IndexerError> {
// TODO update on launch
let odin = Odin::connect(
Some(vec![
"nats://localhost:4228".to_string(),
"nats://localhost:4229".to_string(),
"nats://65.108.110.11:4222".to_string(),
"nats://95.216.243.233:4222".to_string(),
]),
Some(ConnectOptions::with_user_and_password(
"alexandria".to_string(),
"alexandria".to_string(),
"very-stronk-alexandria".to_string(),
)),
)
.await;
Expand Down
Loading

0 comments on commit 0df29d6

Please sign in to comment.