Skip to content

Commit

Permalink
config routing
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk committed Jan 12, 2025
1 parent 32badd9 commit 45dec23
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,20 @@ impl InterchainSecurityModule for StarknetInterchainSecurityModule {
message,
);

println!(
"StarknetISM dry_run_verify address {:?} with metadata {:?} with size {:?}",
self.contract.address,
metadata.iter().map(|b| *b as u128).collect::<Vec<_>>(),
metadata.len()
);

let response = tx
.call()
.await
.map_err(Into::<HyperlaneStarknetError>::into)?;

println!("StarknetISM dry_run_verify response {:?}", response);

// We can't simulate the `verify` call in Starknet because
// it's not marked as an entrypoint. So we just use the query interface
// and hardcode a gas value - this can be inefficient if one ISM is
Expand Down
10 changes: 8 additions & 2 deletions rust/main/hyperlane-base/src/settings/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,14 @@ impl ChainConf {
)?);
Ok(ism as Box<dyn RoutingIsm>)
}
ChainConnectionConf::Starknet(_) => {
Err(eyre!("Starknet does not support routing ISM yet")).context(ctx)
ChainConnectionConf::Starknet(conf) => {
let signer = self.starknet_signer().await.context(ctx)?;
let ism = Box::new(h_starknet::StarknetRoutingIsm::new(
conf,
&locator,
signer.unwrap(),
)?);
Ok(ism as Box<dyn RoutingIsm>)
}
}
.context(ctx)
Expand Down
17 changes: 15 additions & 2 deletions rust/main/utils/run-locally/src/starknet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ fn run_locally() {
})
.collect::<Vec<_>>();

let domains = nodes.iter().map(|v| v.3).collect::<Vec<_>>();

let deployer = "0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca"; // 1st katana account
let _linker = "validator";
let validator = &ValidatorConfig {
Expand All @@ -335,8 +337,19 @@ fn run_locally() {
let declarations =
utils::declare_all(starknet_cli.clone(), sierra_classes.clone()).join();

let deployments =
utils::deploy_all(starknet_cli, deployer.to_string(), declarations, domain);
let remotes = domains
.iter()
.filter(|v| *v != &domain)
.cloned()
.collect::<Vec<_>>();

let deployments = utils::deploy_all(
starknet_cli,
deployer.to_string(),
declarations,
domain,
remotes,
);

(launch_resp, deployments, chain_id, metrics_port, domain)
})
Expand Down
42 changes: 28 additions & 14 deletions rust/main/utils/run-locally/src/starknet/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,8 @@ pub(crate) fn deploy_all(
deployer: String,
declarations: DeclaredClasses,
domain: u32,
remotes: Vec<u32>,
) -> Deployments {
// deploy ism - routing ism with empty routes
println!("Deploying routing ism");
let ism_routing = cli.deploy(declarations.hpl_ism_routing, vec![deployer.clone()]);

println!("Initializing routing ism");
cli.invoke(
ism_routing.clone(),
"initialize",
vec!["0".to_string(), "0".to_string()],
);

// deploy ism - multisig ism with no enrolled validators
println!("Deploying message id multisig ism");
let ism_multisig = cli.deploy(
Expand All @@ -156,9 +146,33 @@ pub(crate) fn deploy_all(
"2".to_string(),
ism_multisig.clone(),
ism_pausable,
THRESHOLD.to_string(),
"2".to_string(),
],
);

// deploy ism - routing ism
println!("Deploying routing ism");
let default_ism = cli.deploy(declarations.hpl_ism_routing, vec![deployer.clone()]);

println!(
"Initializing routing ism with for origin domains: {:?}",
remotes
);
cli.invoke(
default_ism.clone(),
"initialize",
vec![
remotes.len().to_string(),
remotes
.iter()
.map(|v| v.to_string())
.collect::<Vec<_>>()
.join(" "),
remotes.len().to_string(),
vec![default_ism.clone(); remotes.len()].join(" "),
],
);

// deploy mock hook
println!("Deploying mock hook");
let mock_hook = cli.deploy(declarations.hpl_test_mock_hook, vec![]);
Expand Down Expand Up @@ -191,7 +205,7 @@ pub(crate) fn deploy_all(
println!("Deploying mock receiver");
let mock_receiver = cli.deploy(
declarations.hpl_test_mock_msg_receiver,
vec![ism_multisig.clone()],
vec![default_ism.clone()],
);

let mock_ism = cli.deploy(declarations.hpl_test_mock_ism, vec![]);
Expand Down Expand Up @@ -219,7 +233,7 @@ pub(crate) fn deploy_all(

Deployments {
mailbox,
ism_routing,
ism_routing: default_ism,
ism_multisig,
ism_aggregate,
hook_merkle,
Expand Down

0 comments on commit 45dec23

Please sign in to comment.