diff --git a/Cargo.lock b/Cargo.lock index b36a557d..523ccfd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3124,7 +3124,7 @@ dependencies = [ "serde", "serde_json", "sqlx", - "tap_core", + "tap_core 0.7.0 (git+https://github.com/semiotic-ai/timeline-aggregation-protocol?rev=790e31f)", "test-log", "thegraph", "thiserror", @@ -3164,7 +3164,7 @@ dependencies = [ "serde_yaml", "sqlx", "tap_aggregator", - "tap_core", + "tap_core 0.7.0 (git+https://github.com/semiotic-ai/timeline-aggregation-protocol?rev=790e31f)", "tempfile", "thegraph", "thiserror", @@ -5716,7 +5716,7 @@ dependencies = [ "serde_spanned", "sha3", "sqlx", - "tap_core", + "tap_core 0.7.0 (git+https://github.com/semiotic-ai/timeline-aggregation-protocol?branch=aasseman/tap_core_0_7_0_fix_toolshed_dep)", "test-log", "thegraph", "thiserror", @@ -6354,7 +6354,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tap_aggregator" version = "0.2.0" -source = "git+https://github.com/semiotic-ai/timeline-aggregation-protocol?branch=aasseman/tap_core_0_7_0_fix_toolshed_dep#ae4fc69a5de5a33528b31284a32f71ae1093186c" +source = "git+https://github.com/semiotic-ai/timeline-aggregation-protocol?rev=790e31f#790e31fa3d2c1844c332e5a7ff8bb012c9c5a187" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -6373,7 +6373,7 @@ dependencies = [ "serde", "serde_json", "strum 0.24.1", - "tap_core", + "tap_core 0.7.0 (git+https://github.com/semiotic-ai/timeline-aggregation-protocol?rev=790e31f)", "thegraph", "tokio", "tracing-subscriber", @@ -6403,6 +6403,30 @@ dependencies = [ "tokio", ] +[[package]] +name = "tap_core" +version = "0.7.0" +source = "git+https://github.com/semiotic-ai/timeline-aggregation-protocol?rev=790e31f#790e31fa3d2c1844c332e5a7ff8bb012c9c5a187" +dependencies = [ + "alloy-sol-types", + "anyhow", + "async-trait", + "ethereum-types", + "ethers", + "ethers-contract", + "ethers-contract-derive", + "ethers-core", + "rand 0.8.5", + "rand_core 0.6.4", + "rstest", + "serde", + "strum 0.24.1", + "strum_macros 0.24.3", + "thegraph", + "thiserror", + "tokio", +] + [[package]] name = "tempfile" version = "3.8.0" diff --git a/common/Cargo.toml b/common/Cargo.toml index f0b16db0..70e9aee2 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -34,7 +34,7 @@ thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0 graphql-http = { git = "https://github.com/edgeandnode/toolshed", tag = "graphql-http-v0.2.1", features = [ "http-reqwest", ] } -tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" } +tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", rev = "790e31f" } axum = { version = "0.6.20", default_features = true, features = ["headers"] } thiserror = "1.0.49" async-trait = "0.1.74" diff --git a/tap-agent/Cargo.toml b/tap-agent/Cargo.toml index f4970c4c..bea088b9 100644 --- a/tap-agent/Cargo.toml +++ b/tap-agent/Cargo.toml @@ -33,8 +33,8 @@ sqlx = { version = "0.7.2", features = [ "rust_decimal", "chrono", ] } -tap_aggregator = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" } -tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" } +tap_aggregator = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", rev = "790e31f" } +tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", rev = "790e31f" } thiserror = "1.0.44" tokio = { version = "1.33.0" } thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0.5.0" } diff --git a/tap-agent/src/tap/rav_storage_adapter.rs b/tap-agent/src/tap/rav_storage_adapter.rs index 4760174d..11b899fa 100644 --- a/tap-agent/src/tap/rav_storage_adapter.rs +++ b/tap-agent/src/tap/rav_storage_adapter.rs @@ -60,8 +60,8 @@ impl RAVStorageAdapterTrait for RAVStorageAdapter { self.sender.encode_hex::(), signature_bytes, self.allocation_id.encode_hex::(), - BigDecimal::from(rav.message.timestamp_ns), - BigDecimal::from(BigInt::from(rav.message.value_aggregate)), + BigDecimal::from(rav.message.timestampNs), + BigDecimal::from(BigInt::from(rav.message.valueAggregate)), chrono::Utc::now() ) .execute(&self.pgpool) @@ -125,9 +125,9 @@ impl RAVStorageAdapterTrait for RAVStorageAdapter { })?; let rav = ReceiptAggregateVoucher { - allocation_id, - timestamp_ns, - value_aggregate, + allocationId: allocation_id, + timestampNs: timestamp_ns, + valueAggregate: value_aggregate, }; Ok(Some(SignedRAV { message: rav, diff --git a/tap-agent/src/tap/sender_account.rs b/tap-agent/src/tap/sender_account.rs index 3bee1f6c..87786e43 100644 --- a/tap-agent/src/tap/sender_account.rs +++ b/tap-agent/src/tap/sender_account.rs @@ -768,11 +768,11 @@ mod tests { let latest_rav = EIP712SignedMessage { message: ReceiptAggregateVoucher { - allocation_id: Address::from_str(&latest_rav.allocation_id).unwrap(), - timestamp_ns: latest_rav.timestamp_ns.to_u64().unwrap(), + allocationId: Address::from_str(&latest_rav.allocation_id).unwrap(), + timestampNs: latest_rav.timestamp_ns.to_u64().unwrap(), // Beware, BigDecimal::to_u128() actually uses to_u64() under the hood... // So we're converting to BigInt to get a proper implementation of to_u128(). - value_aggregate: latest_rav + valueAggregate: latest_rav .value_aggregate .to_bigint() .map(|v| v.to_u128()) @@ -783,7 +783,7 @@ mod tests { }; // Check that the latest RAV value is correct. - assert!(latest_rav.message.value_aggregate >= trigger_value); + assert!(latest_rav.message.valueAggregate >= trigger_value); // Check that the allocation's unaggregated fees value is reduced. assert!( @@ -859,11 +859,11 @@ mod tests { let latest_rav = EIP712SignedMessage { message: ReceiptAggregateVoucher { - allocation_id: Address::from_str(&latest_rav.allocation_id).unwrap(), - timestamp_ns: latest_rav.timestamp_ns.to_u64().unwrap(), + allocationId: Address::from_str(&latest_rav.allocation_id).unwrap(), + timestampNs: latest_rav.timestamp_ns.to_u64().unwrap(), // Beware, BigDecimal::to_u128() actually uses to_u64() under the hood... // So we're converting to BigInt to get a proper implementation of to_u128(). - value_aggregate: latest_rav + valueAggregate: latest_rav .value_aggregate .to_bigint() .map(|v| v.to_u128()) @@ -875,7 +875,7 @@ mod tests { // Check that the latest RAV value is correct. - assert!(latest_rav.message.value_aggregate >= trigger_value); + assert!(latest_rav.message.valueAggregate >= trigger_value); // Check that the allocation's unaggregated fees value is reduced. assert!( diff --git a/tap-agent/src/tap/test_utils.rs b/tap-agent/src/tap/test_utils.rs index 9f2b895b..c3b6cf65 100644 --- a/tap-agent/src/tap/test_utils.rs +++ b/tap-agent/src/tap/test_utils.rs @@ -85,9 +85,9 @@ pub async fn create_rav( EIP712SignedMessage::new( &TAP_EIP712_DOMAIN_SEPARATOR, ReceiptAggregateVoucher { - allocation_id, - timestamp_ns, - value_aggregate, + allocationId: allocation_id, + timestampNs: timestamp_ns, + valueAggregate: value_aggregate, }, &signer_wallet, ) @@ -137,9 +137,9 @@ pub async fn store_rav(pgpool: &PgPool, signed_rav: SignedRAV, sender: Address) "#, sender.encode_hex::(), signature_bytes, - signed_rav.message.allocation_id.encode_hex::(), - BigDecimal::from(signed_rav.message.timestamp_ns), - BigDecimal::from(BigInt::from(signed_rav.message.value_aggregate)), + signed_rav.message.allocationId.encode_hex::(), + BigDecimal::from(signed_rav.message.timestampNs), + BigDecimal::from(BigInt::from(signed_rav.message.valueAggregate)), ) .execute(pgpool) .await?;