Skip to content

Commit f73ee0b

Browse files
authored
last round of PR remediations (#2791)
Remediations for #2746, in addition to #2780
1 parent 5c8d483 commit f73ee0b

File tree

4 files changed

+60
-71
lines changed

4 files changed

+60
-71
lines changed

rust/agents/relayer/src/processor.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use derive_new::new;
55
use eyre::Result;
66
use hyperlane_core::HyperlaneDomain;
77
use tokio::task::JoinHandle;
8-
use tracing::{info_span, instrument, instrument::Instrumented, Instrument};
8+
use tracing::instrument;
99

1010
#[async_trait]
1111
pub trait ProcessorExt: Send + Debug {
@@ -23,9 +23,8 @@ pub struct Processor {
2323
}
2424

2525
impl Processor {
26-
pub fn spawn(self) -> Instrumented<JoinHandle<Result<()>>> {
27-
let span = info_span!("MessageProcessor");
28-
tokio::spawn(async move { self.main_loop().await }).instrument(span)
26+
pub fn spawn(self) -> JoinHandle<Result<()>> {
27+
tokio::spawn(async move { self.main_loop().await })
2928
}
3029

3130
#[instrument(ret, err, skip(self), level = "info", fields(domain=%self.ticker.domain()))]

rust/config/test_sealevel_config.json

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
11
{
2-
"chains": {
3-
"sealeveltest1": {
4-
"name": "sealeveltest1",
5-
"chainId": 13375,
6-
"domainId": 13375,
7-
"mailbox": "692KZJaoe2KRcD6uhCQDLLXnLNA5ZLnfvdqjE4aX9iu1",
8-
"interchainGasPaymaster": "DrFtxirPPsfdY4HQiNZj2A9o4Ux7JaL3gELANgAoihhp",
9-
"validatorAnnounce": "DH43ae1LwemXAboWwSh8zc9pG8j72gKUEXNi57w8fEnn",
10-
"protocol": "sealevel",
11-
"blocks": {
12-
"reorgPeriod": 0,
13-
"confirmations": 0
14-
},
15-
"rpcUrls": [
16-
{
17-
"http": "http://localhost:8899"
18-
}
19-
],
20-
"index": {
21-
"from": 1,
22-
"mode": "sequence"
23-
}
24-
},
25-
"sealeveltest2": {
26-
"name": "sealeveltest2",
27-
"chainId": 13376,
28-
"domainId": 13376,
29-
"mailbox": "9tCUWNjpqcf3NUSrtp7vquYVCwbEByvLjZUrhG5dgvhj",
30-
"interchainGasPaymaster": "G5rGigZBL8NmxCaukK2CAKr9Jq4SUfAhsjzeri7GUraK",
31-
"validatorAnnounce": "3Uo5j2Bti9aZtrDqJmAyuwiFaJFPFoNL5yxTpVCNcUhb",
32-
"protocol": "sealevel",
33-
"blocks": {
34-
"reorgPeriod": 0,
35-
"confirmations": 0
36-
},
37-
"rpcUrls": [
38-
{
39-
"http": "http://localhost:8899"
40-
}
41-
],
42-
"index": {
43-
"from": 1,
44-
"mode": "sequence"
45-
}
2+
"chains": {
3+
"sealeveltest1": {
4+
"name": "sealeveltest1",
5+
"chainId": 13375,
6+
"domainId": 13375,
7+
"mailbox": "692KZJaoe2KRcD6uhCQDLLXnLNA5ZLnfvdqjE4aX9iu1",
8+
"merkleTreeHook": "692KZJaoe2KRcD6uhCQDLLXnLNA5ZLnfvdqjE4aX9iu1",
9+
"interchainGasPaymaster": "DrFtxirPPsfdY4HQiNZj2A9o4Ux7JaL3gELANgAoihhp",
10+
"validatorAnnounce": "DH43ae1LwemXAboWwSh8zc9pG8j72gKUEXNi57w8fEnn",
11+
"protocol": "sealevel",
12+
"blocks": {
13+
"reorgPeriod": 0,
14+
"confirmations": 0
15+
},
16+
"rpcUrls": [
17+
{
18+
"http": "http://localhost:8899"
4619
}
20+
],
21+
"index": {
22+
"from": 1,
23+
"mode": "sequence"
24+
}
25+
},
26+
"sealeveltest2": {
27+
"name": "sealeveltest2",
28+
"chainId": 13376,
29+
"domainId": 13376,
30+
"mailbox": "9tCUWNjpqcf3NUSrtp7vquYVCwbEByvLjZUrhG5dgvhj",
31+
"merkleTreeHook": "9tCUWNjpqcf3NUSrtp7vquYVCwbEByvLjZUrhG5dgvhj",
32+
"interchainGasPaymaster": "G5rGigZBL8NmxCaukK2CAKr9Jq4SUfAhsjzeri7GUraK",
33+
"validatorAnnounce": "3Uo5j2Bti9aZtrDqJmAyuwiFaJFPFoNL5yxTpVCNcUhb",
34+
"protocol": "sealevel",
35+
"blocks": {
36+
"reorgPeriod": 0,
37+
"confirmations": 0
38+
},
39+
"rpcUrls": [
40+
{
41+
"http": "http://localhost:8899"
42+
}
43+
],
44+
"index": {
45+
"from": 1,
46+
"mode": "sequence"
47+
}
4748
}
48-
}
49+
}
50+
}

rust/hyperlane-base/src/settings/chains.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub struct CoreContractAddresses {
8585
/// Address of the ValidatorAnnounce contract
8686
pub validator_announce: H256,
8787
/// Address of the MerkleTreeHook contract
88-
pub merkle_tree_hook: Option<H256>,
88+
pub merkle_tree_hook: H256,
8989
}
9090

9191
/// Indexing settings
@@ -173,13 +173,7 @@ impl ChainConf {
173173
metrics: &CoreMetrics,
174174
) -> Result<Box<dyn MerkleTreeHook>> {
175175
let ctx = "Building merkle tree hook";
176-
// TODO: if the merkle tree hook is set for sealevel, it's still a mailbox program
177-
// that the connection is made to using the pda seeds, which will not be usable.
178-
let address = self
179-
.addresses
180-
.merkle_tree_hook
181-
.unwrap_or(self.addresses.mailbox);
182-
let locator = self.locator(address);
176+
let locator = self.locator(self.addresses.merkle_tree_hook);
183177

184178
match &self.connection {
185179
ChainConnectionConf::Ethereum(conf) => {
@@ -368,11 +362,7 @@ impl ChainConf {
368362
metrics: &CoreMetrics,
369363
) -> Result<Box<dyn SequenceIndexer<MerkleTreeInsertion>>> {
370364
let ctx = "Building merkle tree hook indexer";
371-
let address = self
372-
.addresses
373-
.merkle_tree_hook
374-
.unwrap_or(self.addresses.mailbox);
375-
let locator = self.locator(address);
365+
let locator = self.locator(self.addresses.merkle_tree_hook);
376366

377367
match &self.connection {
378368
ChainConnectionConf::Ethereum(conf) => {
@@ -704,13 +694,11 @@ impl ChainConf {
704694
self.addresses.interchain_gas_paymaster,
705695
EthereumInterchainGasPaymasterAbi::fn_map_owned(),
706696
);
707-
if let Some(address) = self.addresses.merkle_tree_hook {
708-
register_contract(
709-
"merkle_tree_hook",
710-
address,
711-
EthereumInterchainGasPaymasterAbi::fn_map_owned(),
712-
);
713-
}
697+
register_contract(
698+
"merkle_tree_hook",
699+
self.addresses.merkle_tree_hook,
700+
EthereumInterchainGasPaymasterAbi::fn_map_owned(),
701+
);
714702

715703
cfg
716704
}

rust/hyperlane-base/src/settings/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn parse_chain(
221221
.end();
222222
let merkle_tree_hook = chain
223223
.chain(&mut err)
224-
.get_opt_key("merkleTreeHook")
224+
.get_key("merkleTreeHook")
225225
.parse_address_hash()
226226
.end();
227227

@@ -234,7 +234,7 @@ fn parse_chain(
234234
default_rpc_consensus_type,
235235
);
236236

237-
cfg_unwrap_all!(&chain.cwp, err: [connection, mailbox, interchain_gas_paymaster, validator_announce]);
237+
cfg_unwrap_all!(&chain.cwp, err: [connection, mailbox, interchain_gas_paymaster, validator_announce, merkle_tree_hook]);
238238
err.into_result(ChainConf {
239239
domain,
240240
signer,

0 commit comments

Comments
 (0)