diff --git a/chain-signatures/node/src/indexer_eth.rs b/chain-signatures/node/src/indexer_eth.rs index c18d8d7b..d0e4bec3 100644 --- a/chain-signatures/node/src/indexer_eth.rs +++ b/chain-signatures/node/src/indexer_eth.rs @@ -52,7 +52,7 @@ impl Options { self.eth_rpc_url, "--eth-contract-address".to_string(), self.eth_contract_address, - "--eth-start-block".to_string(), + "--eth-start-block-height".to_string(), self.eth_start_block_height.to_string(), "--eth-behind-threshold".to_string(), self.eth_behind_threshold.to_string(), diff --git a/chain-signatures/node/src/lib.rs b/chain-signatures/node/src/lib.rs index a04c0b6c..edb0cc08 100644 --- a/chain-signatures/node/src/lib.rs +++ b/chain-signatures/node/src/lib.rs @@ -3,7 +3,7 @@ pub mod config; pub mod gcp; pub mod http_client; pub mod indexer; -mod indexer_eth; +pub mod indexer_eth; pub mod kdf; pub mod mesh; pub mod metrics; diff --git a/integration-tests/chain-signatures/src/containers.rs b/integration-tests/chain-signatures/src/containers.rs index 460d51d2..86bab661 100644 --- a/integration-tests/chain-signatures/src/containers.rs +++ b/integration-tests/chain-signatures/src/containers.rs @@ -100,7 +100,13 @@ impl<'a> Node<'a> { running_threshold: 120, behind_threshold: 120, }; - + let indexer_eth_options = mpc_node::indexer_eth::Options { + eth_rpc_url: "http://localhost:8545".to_string(), + eth_contract_address: "0x5FbDB2315678afecb367f032d93F642f64180aa3".to_string(), + eth_start_block_height: 0, + eth_behind_threshold: 120, + eth_running_threshold: 120, + }; let args = mpc_node::cli::Cli::Start { near_rpc: config.near_rpc.clone(), mpc_contract_id: ctx.mpc_contract.id().clone(), @@ -110,6 +116,7 @@ impl<'a> Node<'a> { cipher_pk: hex::encode(config.cipher_pk.to_bytes()), cipher_sk: hex::encode(config.cipher_sk.to_bytes()), indexer_options: indexer_options.clone(), + indexer_eth_options, my_address: None, storage_options: ctx.storage_options.clone(), sign_sk: Some(config.sign_sk.clone()), diff --git a/integration-tests/chain-signatures/src/local.rs b/integration-tests/chain-signatures/src/local.rs index 923ccb15..a9a8f3eb 100644 --- a/integration-tests/chain-signatures/src/local.rs +++ b/integration-tests/chain-signatures/src/local.rs @@ -56,6 +56,13 @@ impl Node { running_threshold: 120, behind_threshold: 120, }; + let indexer_eth_options = mpc_node::indexer_eth::Options { + eth_rpc_url: "http://localhost:8545".to_string(), + eth_contract_address: "0x5FbDB2315678afecb367f032d93F642f64180aa3".to_string(), + eth_start_block_height: 0, + eth_behind_threshold: 120, + eth_running_threshold: 120, + }; let near_rpc = ctx.lake_indexer.rpc_host_address.clone(); let mpc_contract_id = ctx.mpc_contract.id().clone(); let cli = mpc_node::cli::Cli::Start { @@ -68,6 +75,7 @@ impl Node { cipher_sk: hex::encode(cipher_sk.to_bytes()), sign_sk: Some(sign_sk.clone()), indexer_options, + indexer_eth_options, my_address: None, storage_options: ctx.storage_options.clone(), override_config: Some(OverrideConfig::new(serde_json::to_value( @@ -151,6 +159,13 @@ impl Node { running_threshold: 120, behind_threshold: 120, }; + let indexer_eth_options = mpc_node::indexer_eth::Options { + eth_rpc_url: "http://localhost:8545".to_string(), + eth_contract_address: "0x5FbDB2315678afecb367f032d93F642f64180aa3".to_string(), + eth_start_block_height: 0, + eth_behind_threshold: 120, + eth_running_threshold: 120, + }; let cli = mpc_node::cli::Cli::Start { near_rpc: config.near_rpc.clone(), mpc_contract_id: ctx.mpc_contract.id().clone(), @@ -161,6 +176,7 @@ impl Node { cipher_sk: hex::encode(config.cipher_sk.to_bytes()), sign_sk: Some(config.sign_sk.clone()), indexer_options, + indexer_eth_options, my_address: None, storage_options: ctx.storage_options.clone(), override_config: Some(OverrideConfig::new(serde_json::to_value( diff --git a/integration-tests/chain-signatures/tests/cases/mod.rs b/integration-tests/chain-signatures/tests/cases/mod.rs index 2f696b0b..2663b44a 100644 --- a/integration-tests/chain-signatures/tests/cases/mod.rs +++ b/integration-tests/chain-signatures/tests/cases/mod.rs @@ -111,6 +111,18 @@ async fn test_signature_basic() -> anyhow::Result<()> { .await } +#[test(tokio::test)] +async fn test_signature_from_eth() -> anyhow::Result<()> { + with_multichain_nodes(MultichainConfig::default(), |ctx| { + Box::pin(async move { + let state_0 = wait_for::running_mpc(&ctx, Some(0)).await?; + assert_eq!(state_0.participants.len(), 3); + Ok(()) + }) + }) + .await +} + #[test(tokio::test)] async fn test_signature_offline_node() -> anyhow::Result<()> { with_multichain_nodes(MultichainConfig::default(), |mut ctx| {