Skip to content

Commit

Permalink
Merge branch 'main' into eddy/typechain-v11
Browse files Browse the repository at this point in the history
  • Loading branch information
byeongsu-hong authored Mar 13, 2024
2 parents eb74597 + f9d67aa commit 51c2087
Show file tree
Hide file tree
Showing 201 changed files with 9,304 additions and 4,467 deletions.
5 changes: 0 additions & 5 deletions .changeset/cuddly-fishes-repair.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/funny-pans-return.md

This file was deleted.

13 changes: 0 additions & 13 deletions .changeset/green-pans-unite.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/lazy-guests-enjoy.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/modern-adults-sell.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/modern-dryers-jump.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/olive-starfishes-exercise.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/orange-kangaroos-allow.md

This file was deleted.

18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ jobs:
strategy:
matrix:
include:
- hook: preset_hook_enabled
- hook: configure_hook_enabled
- test-type: preset_hook_enabled
- test-type: configure_hook_enabled
- test-type: pi_with_core_chain
steps:
- uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -284,18 +285,14 @@ jobs:
~/.cargo
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('./rust/Cargo.lock') }}

- name: cli e2e tests with preset hook config
run: ./typescript/cli/ci-test.sh false
if: matrix.hook == 'preset_hook_enabled'

- name: cli e2e tests with configured hook config
run: ./typescript/cli/ci-test.sh true
if: matrix.hook == 'configure_hook_enabled'
- name: cli e2e tests
run: ./typescript/cli/ci-test.sh ${{ matrix.test-type }}

env-test:
runs-on: ubuntu-latest
needs: [yarn-build]
strategy:
fail-fast: false
matrix:
environment: [mainnet3]
chain: [ethereum, arbitrum, optimism, inevm, viction]
Expand All @@ -304,6 +301,9 @@ jobs:
- environment: testnet4
chain: sepolia
module: core
- environment: mainnet3
chain: inevm
module: warp

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COPY typescript/sdk/package.json ./typescript/sdk/
COPY typescript/helloworld/package.json ./typescript/helloworld/
COPY typescript/cli/package.json ./typescript/cli/
COPY typescript/infra/package.json ./typescript/infra/
COPY typescript/ccip-server/package.json ./typescript/ccip-server/
COPY solidity/package.json ./solidity/

RUN yarn install && yarn cache clean
Expand Down
1 change: 1 addition & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ target
validatordb
relayerdb
kathydb
hyperlane_db
config/test_config.json
3 changes: 3 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ cosmrs = { version = "0.14", default-features = false, features = [
"tokio",
"grpc",
] }
cosmwasm-std = "*"
crunchy = "0.2"
ctrlc = "3.2"
curve25519-dalek = { version = "~3.2", features = ["serde"] }
Expand Down
2 changes: 1 addition & 1 deletion rust/agents/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tokio = { workspace = true, features = ["rt", "macros", "parking_lot"] }
tracing-futures.workspace = true
tracing.workspace = true

hyperlane-core = { path = "../../hyperlane-core", features = ["agent", "fallback-provider"] }
hyperlane-core = { path = "../../hyperlane-core", features = ["agent", "async"] }
hyperlane-base = { path = "../../hyperlane-base" }
hyperlane-ethereum = { path = "../../chains/hyperlane-ethereum" }

Expand Down
2 changes: 1 addition & 1 deletion rust/agents/relayer/src/msg/pending_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl PendingOperation for PendingMessage {
.await,
"checking if message meets gas payment requirement"
) else {
info!(?tx_cost_estimate, "Gas payment requirement not met yet");
warn!(?tx_cost_estimate, "Gas payment requirement not met yet");
return self.on_reprepare();
};

Expand Down
1 change: 1 addition & 0 deletions rust/agents/relayer/src/msg/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ mod test {
domain_name: name.to_owned(),
domain_type: test_domain.domain_type(),
domain_protocol: test_domain.domain_protocol(),
domain_technical_stack: test_domain.domain_technical_stack(),
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "arbitrumgoerli",
token: "ETH",
domain: 421613,
chain_id: 421613,
is_test_net: true,
is_deprecated: false,
},
RawDomain {
name: "avalanche",
token: "AVAX",
Expand Down Expand Up @@ -102,14 +94,6 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "goerli",
token: "ETH",
domain: 5,
chain_id: 5,
is_test_net: true,
is_deprecated: false,
},
RawDomain {
name: "mantapacific",
token: "ETH",
Expand Down Expand Up @@ -150,14 +134,6 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "optimismgoerli",
token: "ETH",
domain: 420,
chain_id: 420,
is_test_net: true,
is_deprecated: false,
},
RawDomain {
name: "polygon",
token: "MATIC",
Expand All @@ -174,14 +150,6 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "polygonzkevmtestnet",
token: "ETH",
domain: 1442,
chain_id: 1442,
is_test_net: true,
is_deprecated: false,
},
RawDomain {
name: "scroll",
token: "ETH",
Expand Down
2 changes: 1 addition & 1 deletion rust/agents/validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tokio = { workspace = true, features = ["rt", "macros", "parking_lot"] }
tracing-futures.workspace = true
tracing.workspace = true

hyperlane-core = { path = "../../hyperlane-core", features = ["agent", "fallback-provider"] }
hyperlane-core = { path = "../../hyperlane-core", features = ["agent", "async"] }
hyperlane-base = { path = "../../hyperlane-base" }
hyperlane-ethereum = { path = "../../chains/hyperlane-ethereum" }
hyperlane-cosmos = { path = "../../chains/hyperlane-cosmos" }
Expand Down
68 changes: 41 additions & 27 deletions rust/agents/validator/src/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ use std::sync::Arc;
use std::time::{Duration, Instant};
use std::vec;

use eyre::{bail, Result};
use hyperlane_core::MerkleTreeHook;
use hyperlane_core::rpc_clients::call_and_retry_indefinitely;
use hyperlane_core::{ChainCommunicationError, ChainResult, MerkleTreeHook};
use prometheus::IntGauge;
use tokio::time::sleep;
use tracing::{debug, info};
use tracing::{error, instrument};
use tracing::{debug, error, info};

use hyperlane_base::{db::HyperlaneRocksDB, CheckpointSyncer, CoreMetrics};
use hyperlane_core::{
Expand Down Expand Up @@ -60,29 +59,28 @@ impl ValidatorSubmitter {

/// Submits signed checkpoints from index 0 until the target checkpoint (inclusive).
/// Runs idly forever once the target checkpoint is reached to avoid exiting the task.
#[instrument(err, skip(self), fields(domain=%self.merkle_tree_hook.domain()))]
pub(crate) async fn backfill_checkpoint_submitter(
self,
target_checkpoint: Checkpoint,
) -> Result<()> {
pub(crate) async fn backfill_checkpoint_submitter(self, target_checkpoint: Checkpoint) {
let mut tree = IncrementalMerkle::default();
self.submit_checkpoints_until_correctness_checkpoint(&mut tree, &target_checkpoint)
.await?;
call_and_retry_indefinitely(|| {
let target_checkpoint = target_checkpoint;
let self_clone = self.clone();
Box::pin(async move {
self_clone
.submit_checkpoints_until_correctness_checkpoint(&mut tree, &target_checkpoint)
.await?;
Ok(())
})
})
.await;

info!(
?target_checkpoint,
"Backfill checkpoint submitter successfully reached target checkpoint"
);

// TODO: remove this once validator is tolerant of tasks exiting.
loop {
sleep(Duration::from_secs(u64::MAX)).await;
}
}

/// Submits signed checkpoints indefinitely, starting from the `tree`.
#[instrument(err, skip(self, tree), fields(domain=%self.merkle_tree_hook.domain()))]
pub(crate) async fn checkpoint_submitter(self, mut tree: IncrementalMerkle) -> Result<()> {
pub(crate) async fn checkpoint_submitter(self, mut tree: IncrementalMerkle) {
// How often to log checkpoint info - once every minute
let checkpoint_info_log_period = Duration::from_secs(60);
// The instant in which we last logged checkpoint info, if at all
Expand All @@ -102,10 +100,12 @@ impl ValidatorSubmitter {

loop {
// Lag by reorg period because this is our correctness checkpoint.
let latest_checkpoint = self
.merkle_tree_hook
.latest_checkpoint(self.reorg_period)
.await?;
let latest_checkpoint = call_and_retry_indefinitely(|| {
let merkle_tree_hook = self.merkle_tree_hook.clone();
Box::pin(async move { merkle_tree_hook.latest_checkpoint(self.reorg_period).await })
})
.await;

self.metrics
.latest_checkpoint_observed
.set(latest_checkpoint.index as i64);
Expand Down Expand Up @@ -133,8 +133,20 @@ impl ValidatorSubmitter {
continue;
}

self.submit_checkpoints_until_correctness_checkpoint(&mut tree, &latest_checkpoint)
.await?;
tree = call_and_retry_indefinitely(|| {
let mut tree = tree;
let self_clone = self.clone();
Box::pin(async move {
self_clone
.submit_checkpoints_until_correctness_checkpoint(
&mut tree,
&latest_checkpoint,
)
.await?;
Ok(tree)
})
})
.await;

self.metrics
.latest_checkpoint_processed
Expand All @@ -150,7 +162,7 @@ impl ValidatorSubmitter {
&self,
tree: &mut IncrementalMerkle,
correctness_checkpoint: &Checkpoint,
) -> Result<()> {
) -> ChainResult<()> {
// This should never be called with a tree that is ahead of the correctness checkpoint.
assert!(
!tree_exceeds_checkpoint(correctness_checkpoint, tree),
Expand Down Expand Up @@ -213,7 +225,9 @@ impl ValidatorSubmitter {
?correctness_checkpoint,
"Incorrect tree root, something went wrong"
);
bail!("Incorrect tree root, something went wrong");
return Err(ChainCommunicationError::CustomError(
"Incorrect tree root, something went wrong".to_string(),
));
}

if !checkpoint_queue.is_empty() {
Expand All @@ -238,7 +252,7 @@ impl ValidatorSubmitter {
async fn sign_and_submit_checkpoints(
&self,
checkpoints: Vec<CheckpointWithMessageId>,
) -> Result<()> {
) -> ChainResult<()> {
let last_checkpoint = checkpoints.as_slice()[checkpoints.len() - 1];

for queued_checkpoint in checkpoints {
Expand Down
Loading

0 comments on commit 51c2087

Please sign in to comment.