Skip to content

Commit

Permalink
feat: checkpoint syncer fraud flag (#4587)
Browse files Browse the repository at this point in the history
Upon detection of a merkle root mismatch between the local merkle tree
(built from indexed events) and the onchain one, reorg diagnostic data
is posted to checkpoint storage.

This PR focuses on the submitter logic and leaves two things for a
follow up PR:
- adding logic to not spin up the validator if a fraud flag has been
posted
- integration testing with S3 and GCP

I assume rolling out to validators will happen after the follow up PR,
but running with logic from this PR will already mean the reorg
diagnostic flag is posted to S3 (though not tested).
  • Loading branch information
daniel-savu authored Oct 4, 2024
1 parent dc9adf3 commit 8809f37
Show file tree
Hide file tree
Showing 15 changed files with 461 additions and 22 deletions.
2 changes: 2 additions & 0 deletions rust/main/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/main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ borsh = "0.9"
bs58 = "0.5.0"
bytes = "1"
clap = "4"
chrono = "*"
color-eyre = "0.6"
config = "0.13.3"
console-subscriber = "0.2.0"
Expand Down
1 change: 1 addition & 0 deletions rust/main/agents/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ mockall.workspace = true
tokio-test.workspace = true
hyperlane-test = { path = "../../hyperlane-test" }
hyperlane-base = { path = "../../hyperlane-base", features = ["test-utils"] }
hyperlane-core = { path = "../../hyperlane-core", features = ["agent", "async", "test-utils"] }

[features]
default = ["color-eyre", "oneline-errors"]
Expand Down
15 changes: 2 additions & 13 deletions rust/main/agents/relayer/src/msg/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ mod test {
settings::{ChainConf, ChainConnectionConf, Settings},
};
use hyperlane_core::{
GasPaymentKey, InterchainGasPayment, InterchainGasPaymentMeta, MerkleTreeInsertion,
PendingOperationStatus, H256,
test_utils::dummy_domain, GasPaymentKey, InterchainGasPayment, InterchainGasPaymentMeta,
MerkleTreeInsertion, PendingOperationStatus, H256,
};
use hyperlane_test::mocks::{MockMailboxContract, MockValidatorAnnounceContract};
use prometheus::{IntCounter, Registry};
Expand Down Expand Up @@ -537,17 +537,6 @@ mod test {
}
}

fn dummy_domain(domain_id: u32, name: &str) -> HyperlaneDomain {
let test_domain = HyperlaneDomain::new_test_domain(name);
HyperlaneDomain::Unknown {
domain_id,
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(),
}
}

/// Only adds database entries to the pending message prefix if the message's
/// retry count is greater than zero
fn persist_retried_messages(
Expand Down
3 changes: 3 additions & 0 deletions rust/main/agents/validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ version.workspace = true
[dependencies]
async-trait.workspace = true
axum.workspace = true
chrono.workspace = true
config.workspace = true
console-subscriber.workspace = true
derive_more.workspace = true
Expand All @@ -36,10 +37,12 @@ hyperlane-ethereum = { path = "../../chains/hyperlane-ethereum" }
hyperlane-cosmos = { path = "../../chains/hyperlane-cosmos" }

[dev-dependencies]
mockall.workspace = true
tokio-test.workspace = true
reqwest.workspace = true
hyperlane-test = { path = "../../hyperlane-test" }
k256.workspace = true
hyperlane-ethereum = { path = "../../chains/hyperlane-ethereum", features = ["test-utils"] }

[features]
default = ["color-eyre", "oneline-errors"]
Expand Down
Loading

0 comments on commit 8809f37

Please sign in to comment.