Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ailisp committed Nov 19, 2024
1 parent 07a0616 commit acf0bba
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chain-signatures/node/src/indexer_eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion chain-signatures/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion integration-tests/chain-signatures/src/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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()),
Expand Down
16 changes: 16 additions & 0 deletions integration-tests/chain-signatures/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(
Expand Down Expand Up @@ -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(),
Expand All @@ -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(
Expand Down
12 changes: 12 additions & 0 deletions integration-tests/chain-signatures/tests/cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit acf0bba

Please sign in to comment.