diff --git a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-2.snap b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-2.snap index 2bc2890ef3..024d4127f4 100644 --- a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-2.snap +++ b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-2.snap @@ -3,4 +3,4 @@ source: api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs assertion_line: 487 expression: "store.storage.get(format!(\"deposit:Polkadot:{}\", format!\n (\"0x{}\", hex ::\n encode(polkadot_account_id.aliased_ref()))).as_str()).unwrap()" --- -[{"amount":"0x64","asset":{"asset":"DOT","chain":"Polkadot"},"deposit_chain_block_height":1}] +[{"amount":"0x64","asset":{"asset":"DOT","chain":"Polkadot"},"deposit_chain_block_height":1,"deposit_details":{"extrinsic_index":1}}] diff --git a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-3.snap b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-3.snap index aafc0683b6..a12dc7e5ef 100644 --- a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-3.snap +++ b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-3.snap @@ -3,4 +3,4 @@ source: api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs assertion_line: 497 expression: "store.storage.get(format!(\"deposit:Ethereum:{}\",\n eth_address_str2.to_lowercase()).as_str()).unwrap()" --- -[{"amount":"0x64","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1}] +[{"amount":"0x64","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1,"deposit_details":null}] diff --git a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-4.snap b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-4.snap index 242c6f9a20..911ef47e1e 100644 --- a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-4.snap +++ b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls-4.snap @@ -3,4 +3,4 @@ source: api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs assertion_line: 521 expression: "store.storage.get(format!(\"deposit:Ethereum:{}\",\n eth_address_str1.to_lowercase()).as_str()).unwrap()" --- -[{"amount":"0x64","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1},{"amount":"0x1e8480","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1}] +[{"amount":"0x64","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1,"deposit_details":null},{"amount":"0x1e8480","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1,"deposit_details":null}] diff --git a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls.snap b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls.snap index fa3c0c426d..417a687ccd 100644 --- a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls.snap +++ b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/snapshots/chainflip_ingress_egress_tracker__witnessing__state_chain__tests__handle_deposit_calls.snap @@ -3,4 +3,4 @@ source: api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs assertion_line: 483 expression: "store.storage.get(format!(\"deposit:Ethereum:{}\",\n eth_address_str1.to_lowercase()).as_str()).unwrap()" --- -[{"amount":"0x64","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1}] +[{"amount":"0x64","asset":{"asset":"ETH","chain":"Ethereum"},"deposit_chain_block_height":1,"deposit_details":null}] diff --git a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs index 1035c0019d..85818481de 100644 --- a/api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs +++ b/api/bin/chainflip-ingress-egress-tracker/src/witnessing/state_chain.rs @@ -4,7 +4,7 @@ use crate::{ }; use cf_chains::{ address::ToHumanreadableAddress, - dot::PolkadotTransactionId, + dot::{PolkadotExtrinsicIndex, PolkadotTransactionId}, evm::{SchnorrVerificationComponents, H256}, AnyChain, Arbitrum, Bitcoin, Chain, Ethereum, Polkadot, }; @@ -58,6 +58,15 @@ enum TransactionId { Arbitrum { signature: SchnorrVerificationComponents }, } +#[derive(Serialize)] +#[serde(untagged)] +enum DepositDetails { + Bitcoin { tx_id: H256, vout: u32 }, + Ethereum { tx_hashes: Vec }, + Polkadot { extrinsic_index: PolkadotExtrinsicIndex }, + Arbitrum { tx_hashes: Vec }, +} + #[derive(Serialize)] #[serde(untagged)] enum WitnessInformation { @@ -67,6 +76,7 @@ enum WitnessInformation { deposit_address: String, amount: NumberOrHex, asset: cf_chains::assets::any::Asset, + deposit_details: Option, }, Broadcast { #[serde(skip_serializing)] @@ -121,6 +131,10 @@ impl From> for WitnessInformation { deposit_address: hex_encode_bytes(value.deposit_address.as_bytes()), amount: value.amount.into(), asset: value.asset.into(), + deposit_details: value + .deposit_details + .tx_hashes + .map(|tx_hashes| DepositDetails::Ethereum { tx_hashes }), } } } @@ -132,6 +146,10 @@ impl From> for WitnessInformation { deposit_address: value.deposit_address.to_humanreadable(network), amount: value.amount.into(), asset: value.asset.into(), + deposit_details: Some(DepositDetails::Bitcoin { + tx_id: value.deposit_details.tx_id, + vout: value.deposit_details.vout, + }), } } } @@ -143,6 +161,9 @@ impl From> for WitnessInformation { deposit_address: hex_encode_bytes(value.deposit_address.aliased_ref()), amount: value.amount.into(), asset: value.asset.into(), + deposit_details: Some(DepositDetails::Polkadot { + extrinsic_index: value.deposit_details, + }), } } } @@ -154,6 +175,10 @@ impl From> for WitnessInformation { deposit_address: hex_encode_bytes(value.deposit_address.as_bytes()), amount: value.amount.into(), asset: value.asset.into(), + deposit_details: value + .deposit_details + .tx_hashes + .map(|tx_hashes| DepositDetails::Arbitrum { tx_hashes }), } } } @@ -208,15 +233,8 @@ where deposit_witnesses, block_height, }) => - for witness in deposit_witnesses as Vec> { - store - .save_to_array(&WitnessInformation::from(( - witness, - block_height, - chainflip_network, - ))) - .await?; - }, + save_deposit_witnesses(store, deposit_witnesses, block_height, chainflip_network) + .await?, ArbitrumIngressEgress(IngressEgressCall::process_deposits { deposit_witnesses, block_height,