Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ path = "tests/pg_pool_health_probe_test.rs"
name = "relay_endpoint_cache_poisoning_test"
path = "tests/network/relay_endpoint_cache_poisoning_test.rs"

[[test]]
name = "ibc_packet_timeout_test"
path = "tests/cross_chain/ibc_packet_timeout_test.rs"

# ── Lint policy ──────────────────────────────────────────────────────────────
# Enforced via `cargo clippy -- -D warnings` in CI. The lints below are the
# style/pedantic ones we deliberately do not churn on:
Expand Down
767 changes: 767 additions & 0 deletions src/cross_chain/ibc/block-time-estimator.rs

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions src/cross_chain/ibc/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! IBC packet commitment timeouts across variable block-time chains
//! (issue #138).
//!
//! An IBC packet carries a `timeout_height` denominated in the *destination*
//! chain's blocks. Deriving that height from a fixed, assumed block time
//! mis-times every packet the moment the destination chain's real block time
//! departs from the assumption — and it departs constantly, both because chains
//! differ from one another and because a single chain's block time moves under
//! load.
//!
//! * [`block_time_estimator`] — the per-chain sliding window of block-time
//! samples and the three statistics derived from it (mean, p95, EMA).
//! * [`packet_timeout`] — the timeout-height formula, its unit derivation, and
//! the cold-start safety margin.
//! * [`packet_relayer`] — in-flight packet tracking, misestimation
//! classification, the recalibration trigger, and the observability events.
//!
//! Samples reach the estimator from the existing header-sync pipeline via
//! [`crate::cross_chain::ConnectedChain::observe_header`]; there is no second
//! header path.
//!
//! Like the rest of [`crate::cross_chain`], everything here is deterministic,
//! integer-only, and dependency-free so it compiles to WASM (`no_std`) and is
//! shared verbatim by off-chain relayers.

#[path = "block-time-estimator.rs"]
pub mod block_time_estimator;

#[path = "packet-timeout.rs"]
pub mod packet_timeout;

#[path = "packet-relayer.rs"]
pub mod packet_relayer;
Loading
Loading