diff --git a/rust/Cargo.lock b/rust/Cargo.lock index d113d81e5..df75f1ca1 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -203,9 +203,9 @@ dependencies = [ [[package]] name = "aptos-indexer-test-transactions" version = "1.0.0" -source = "git+https://github.com/aptos-labs/aptos-core.git?rev=82a8e2bfff1e822781462da83f3abd6cda3f44eb#82a8e2bfff1e822781462da83f3abd6cda3f44eb" +source = "git+https://github.com/aptos-labs/aptos-core.git?rev=b163f034c0e1e01b59cef44694da9dbccb4d5b63#b163f034c0e1e01b59cef44694da9dbccb4d5b63" dependencies = [ - "aptos-protos 1.3.1 (git+https://github.com/aptos-labs/aptos-core.git?rev=82a8e2bfff1e822781462da83f3abd6cda3f44eb)", + "aptos-protos 1.3.1 (git+https://github.com/aptos-labs/aptos-core.git?rev=b163f034c0e1e01b59cef44694da9dbccb4d5b63)", "serde_json", ] @@ -286,7 +286,7 @@ dependencies = [ [[package]] name = "aptos-protos" version = "1.3.1" -source = "git+https://github.com/aptos-labs/aptos-core.git?rev=82a8e2bfff1e822781462da83f3abd6cda3f44eb#82a8e2bfff1e822781462da83f3abd6cda3f44eb" +source = "git+https://github.com/aptos-labs/aptos-core.git?rev=b163f034c0e1e01b59cef44694da9dbccb4d5b63#b163f034c0e1e01b59cef44694da9dbccb4d5b63" dependencies = [ "futures-core", "pbjson", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 6786fec4b..d170b4351 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -34,7 +34,7 @@ aptos-indexer-processor-sdk = { git = "https://github.com/aptos-labs/aptos-index aptos-indexer-processor-sdk-server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "9ecd252ccff53023664562001dd04c2886488c0d" } aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb" } aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "202bdccff2b2d333a385ae86a4fcf23e89da9f62" } -aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "82a8e2bfff1e822781462da83f3abd6cda3f44eb" } +aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "b163f034c0e1e01b59cef44694da9dbccb4d5b63" } async-trait = "0.1.53" backtrace = "0.3.58" base64 = "0.13.0" diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_23.json b/rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_23.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_23.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_23.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_43.json b/rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_43.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_43.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_43.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_65.json b/rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_65.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_65.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_65.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_85.json b/rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_85.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/events_processor/events_processor_85.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/events_processor/events_processor_85.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_23.json b/rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_23.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_23.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_23.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_43.json b/rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_43.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_43.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_43.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_65.json b/rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_65.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_65.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_65.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_85.json b/rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_85.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/fungible_asset_processor/fungible_asset_processor_85.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/fungible_asset_processor/fungible_asset_processor_85.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_23.json b/rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_23.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_23.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_23.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_43.json b/rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_43.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_43.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_43.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_65.json b/rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_65.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_65.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_65.json diff --git a/rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_85.json b/rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_85.json similarity index 100% rename from rust/integration-tests/expected_db_output_files/generated_txns/token_v2_processor/token_v2_processor_85.json rename to rust/integration-tests/expected_db_output_files/scripted_txns/token_v2_processor/token_v2_processor_85.json diff --git a/rust/integration-tests/src/diff_tests/all_tests.rs b/rust/integration-tests/src/diff_tests/all_tests.rs index fb392808e..2b26ea100 100644 --- a/rust/integration-tests/src/diff_tests/all_tests.rs +++ b/rust/integration-tests/src/diff_tests/all_tests.rs @@ -12,13 +12,13 @@ mod test { ProcessorTestHelper, }, diff_tests::{ - get_expected_generated_txns, get_expected_imported_mainnet_txns, - get_expected_imported_testnet_txns, remove_inserted_at, + get_expected_scripted_txns, get_expected_imported_mainnet_txns, + get_expected_imported_testnet_txns, remove_inserted_at, remove_transaction_timestamp, }, DiffTest, TestContext, TestProcessorConfig, TestType, }; use aptos_indexer_test_transactions::{ - ALL_GENERATED_TXNS, ALL_IMPORTED_MAINNET_TXNS, ALL_IMPORTED_TESTNET_TXNS, + ALL_SCRIPTED_TRANSACTIONS, ALL_IMPORTED_MAINNET_TXNS, ALL_IMPORTED_TESTNET_TXNS, }; use assert_json_diff::assert_json_eq; use diesel::pg::PgConnection; @@ -52,14 +52,14 @@ mod test { } #[tokio::test] - async fn test_all_generated_txns_schema_output_for_all_processors() { + async fn test_all_scripted_txns_schema_output_for_all_processors() { let processor_configs = get_processor_configs(); - let test_context = TestContext::new(ALL_GENERATED_TXNS).await.unwrap(); + let test_context = TestContext::new(ALL_SCRIPTED_TRANSACTIONS).await.unwrap(); run_processor_tests( processor_configs, &test_context, - get_expected_generated_txns, + get_expected_scripted_txns, ) .await; } @@ -93,7 +93,7 @@ mod test { }; let expected_json_path = get_expected_json_path_fn(processor_name, txn_version); - let expected_json = match read_and_parse_json(&expected_json_path) { + let mut expected_json = match read_and_parse_json(&expected_json_path) { Ok(json) => json, Err(e) => { eprintln!( @@ -106,6 +106,8 @@ mod test { // TODO: we need to enhance json diff, as we might have more complex diffs. remove_inserted_at(&mut json_data); + remove_transaction_timestamp(&mut json_data); + remove_transaction_timestamp(&mut expected_json); assert_json_eq!(&json_data, &expected_json); println!( diff --git a/rust/integration-tests/src/diff_tests/mod.rs b/rust/integration-tests/src/diff_tests/mod.rs index 5b9cd7f2b..748ea82f7 100644 --- a/rust/integration-tests/src/diff_tests/mod.rs +++ b/rust/integration-tests/src/diff_tests/mod.rs @@ -13,6 +13,17 @@ pub fn remove_inserted_at(value: &mut Value) { } } +#[allow(dead_code)] +pub fn remove_transaction_timestamp(value: &mut Value) { + if let Some(array) = value.as_array_mut() { + for item in array.iter_mut() { + if let Some(obj) = item.as_object_mut() { + obj.remove("transaction_timestamp"); + } + } + } +} + #[allow(dead_code)] pub fn get_expected_imported_testnet_txns(processor_name: &str, txn_version: &str) -> String { format!( @@ -30,9 +41,9 @@ pub fn get_expected_imported_mainnet_txns(processor_name: &str, txn_version: &st } #[allow(dead_code)] -pub fn get_expected_generated_txns(processor_name: &str, txn_version: &str) -> String { +pub fn get_expected_scripted_txns(processor_name: &str, txn_version: &str) -> String { format!( - "expected_db_output_files/generated_txns/{}/{}_{}.json", + "expected_db_output_files/scripted_txns/{}/{}_{}.json", processor_name, processor_name, txn_version ) }