Skip to content

Commit

Permalink
Merge branch 'main' into kunal/avs-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk authored Apr 26, 2024
2 parents ef35202 + af26342 commit 5c1c827
Show file tree
Hide file tree
Showing 132 changed files with 6,194 additions and 2,006 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-dryers-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Add EvmCoreReader, minor updates.
6 changes: 6 additions & 0 deletions .changeset/blue-eyes-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Update the warp-route-deployment.yaml to a more sensible schema. This schema sets us up to allow multi-chain collateral deployments. Removes intermediary config objects by using zod instead.
5 changes: 5 additions & 0 deletions .changeset/early-crabs-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Adds single-chain dry-run support for deploying warp routes & gas estimation for core and warp route dry-run deployments.
5 changes: 5 additions & 0 deletions .changeset/hip-toys-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/infra': minor
---

Moved Hook/ISM reading into CLI.
5 changes: 5 additions & 0 deletions .changeset/khaki-days-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperlane-xyz/sdk": patch
---

Allow gasLimit overrides in the SDK/CLI for deploy txs
6 changes: 6 additions & 0 deletions .changeset/nice-pianos-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Migrate fork util from CLI to SDK. Anvil IP & Port are now optionally passed into fork util by client.
5 changes: 5 additions & 0 deletions .changeset/odd-books-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Introduces `hyperlane hook read` and `hyperlane ism read` commands for deriving onchain Hook/ISM configs from an address on a given chain.
5 changes: 5 additions & 0 deletions .changeset/poor-kings-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/utils': patch
---

Add objLength and isObjEmpty utils
6 changes: 6 additions & 0 deletions .changeset/thirty-games-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/utils': minor
'@hyperlane-xyz/sdk': minor
---

Moved Hook/ISM config stringify into a general object stringify utility.
9 changes: 7 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint","jest"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand Down Expand Up @@ -47,6 +47,11 @@
},
"extendDefaults": true
}
]
],
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.2.0",
"husky": "^8.0.0",
"lint-staged": "^12.4.3",
"prettier": "^2.8.8",
Expand Down
1 change: 1 addition & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ relayerdb
kathydb
hyperlane_db
config/test_config.json
validator_db_anvil*
49 changes: 27 additions & 22 deletions rust/agents/relayer/src/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use hyperlane_base::{
db::{HyperlaneRocksDB, DB},
metrics::{AgentMetrics, MetricsUpdater},
settings::ChainConf,
BaseAgent, ChainMetrics, ContractSyncMetrics, CoreMetrics, HyperlaneAgentCore,
SequencedDataContractSync, WatermarkContractSync,
BaseAgent, ChainMetrics, ContractSyncMetrics, ContractSyncer, CoreMetrics, HyperlaneAgentCore,
};
use hyperlane_core::{
HyperlaneDomain, HyperlaneMessage, InterchainGasPayment, MerkleTreeInsertion, MpmcChannel,
Expand Down Expand Up @@ -60,15 +59,14 @@ pub struct Relayer {
destination_chains: HashMap<HyperlaneDomain, ChainConf>,
#[as_ref]
core: HyperlaneAgentCore,
message_syncs: HashMap<HyperlaneDomain, Arc<SequencedDataContractSync<HyperlaneMessage>>>,
message_syncs: HashMap<HyperlaneDomain, Arc<dyn ContractSyncer<HyperlaneMessage>>>,
interchain_gas_payment_syncs:
HashMap<HyperlaneDomain, Arc<WatermarkContractSync<InterchainGasPayment>>>,
HashMap<HyperlaneDomain, Arc<dyn ContractSyncer<InterchainGasPayment>>>,
/// Context data for each (origin, destination) chain pair a message can be
/// sent between
msg_ctxs: HashMap<ContextKey, Arc<MessageContext>>,
prover_syncs: HashMap<HyperlaneDomain, Arc<RwLock<MerkleTreeBuilder>>>,
merkle_tree_hook_syncs:
HashMap<HyperlaneDomain, Arc<SequencedDataContractSync<MerkleTreeInsertion>>>,
merkle_tree_hook_syncs: HashMap<HyperlaneDomain, Arc<dyn ContractSyncer<MerkleTreeInsertion>>>,
dbs: HashMap<HyperlaneDomain, HyperlaneRocksDB>,
whitelist: Arc<MatchingList>,
blacklist: Arc<MatchingList>,
Expand Down Expand Up @@ -133,35 +131,46 @@ impl BaseAgent for Relayer {
let contract_sync_metrics = Arc::new(ContractSyncMetrics::new(&core_metrics));

let message_syncs = settings
.build_message_indexers(
.contract_syncs::<HyperlaneMessage, _>(
settings.origin_chains.iter(),
&core_metrics,
&contract_sync_metrics,
dbs.iter()
.map(|(d, db)| (d.clone(), Arc::new(db.clone()) as _))
.map(|(d, db)| (d.clone(), Arc::new(db.clone())))
.collect(),
)
.await?;
.await?
.into_iter()
.map(|(k, v)| (k, v as _))
.collect();

let interchain_gas_payment_syncs = settings
.build_interchain_gas_payment_indexers(
.contract_syncs::<InterchainGasPayment, _>(
settings.origin_chains.iter(),
&core_metrics,
&contract_sync_metrics,
dbs.iter()
.map(|(d, db)| (d.clone(), Arc::new(db.clone()) as _))
.map(|(d, db)| (d.clone(), Arc::new(db.clone())))
.collect(),
)
.await?;
.await?
.into_iter()
.map(|(k, v)| (k, v as _))
.collect();

let merkle_tree_hook_syncs = settings
.build_merkle_tree_hook_indexers(
.contract_syncs::<MerkleTreeInsertion, _>(
settings.origin_chains.iter(),
&core_metrics,
&contract_sync_metrics,
dbs.iter()
.map(|(d, db)| (d.clone(), Arc::new(db.clone()) as _))
.map(|(d, db)| (d.clone(), Arc::new(db.clone())))
.collect(),
)
.await?;
.await?
.into_iter()
.map(|(k, v)| (k, v as _))
.collect();

let whitelist = Arc::new(settings.whitelist);
let blacklist = Arc::new(settings.blacklist);
Expand Down Expand Up @@ -341,9 +350,7 @@ impl Relayer {
async fn run_message_sync(&self, origin: &HyperlaneDomain) -> Instrumented<JoinHandle<()>> {
let index_settings = self.as_ref().settings.chains[origin.name()].index_settings();
let contract_sync = self.message_syncs.get(origin).unwrap().clone();
let cursor = contract_sync
.forward_backward_message_sync_cursor(index_settings)
.await;
let cursor = contract_sync.cursor(index_settings).await;
tokio::spawn(async move {
contract_sync
.clone()
Expand All @@ -363,7 +370,7 @@ impl Relayer {
.get(origin)
.unwrap()
.clone();
let cursor = contract_sync.rate_limited_cursor(index_settings).await;
let cursor = contract_sync.cursor(index_settings).await;
tokio::spawn(async move { contract_sync.clone().sync("gas_payments", cursor).await })
.instrument(info_span!("ContractSync"))
}
Expand All @@ -374,9 +381,7 @@ impl Relayer {
) -> Instrumented<JoinHandle<()>> {
let index_settings = self.as_ref().settings.chains[origin.name()].index.clone();
let contract_sync = self.merkle_tree_hook_syncs.get(origin).unwrap().clone();
let cursor = contract_sync
.forward_backward_message_sync_cursor(index_settings)
.await;
let cursor = contract_sync.cursor(index_settings).await;
tokio::spawn(async move { contract_sync.clone().sync("merkle_tree_hook", cursor).await })
.instrument(info_span!("ContractSync"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: true,
is_deprecated: false,
},
RawDomain {
name: "ancient8",
token: "ETH",
domain: 888888888,
chain_id: 888888888,
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "arbitrum",
token: "ETH",
Expand All @@ -46,6 +54,14 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "blast",
token: "ETH",
domain: 81457,
chain_id: 81457,
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "bsc",
token: "BNB",
Expand Down Expand Up @@ -102,6 +118,14 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "mode",
token: "ETH",
domain: 34443,
chain_id: 34443,
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "moonbasealpha",
token: "DEV",
Expand Down
Loading

0 comments on commit 5c1c827

Please sign in to comment.