Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: graceful and alertable relayer reorg detection #5401

Merged
merged 6 commits into from
Feb 10, 2025

Conversation

tkporter
Copy link
Collaborator

@tkporter tkporter commented Feb 7, 2025

Description

  • Only panics in the validator if there is a reorg detected
  • Mostly solves https://github.com/hyperlane-xyz/issues/issues/1394 (does not have super clear alert conditions for a reorg occurring, this should come later)
  • Whereas before we would use Result<Option<Vec<u8>> as a return type for metadata building, where the Result indicates some error occurred (e.g. an RPC issue or something), Ok(Some(_)) meant that metadata building was successful, and Ok(None) meant that no error occurred but simply that fetching metadata wasn't successful -- we now have a new Metadata enum:
#[derive(Clone, Debug)]
pub enum Metadata {
    /// Able to fetch metadata
    Ok(Vec<u8>),
    /// Unable to fetch metadata, but no error occurred
    CouldNotFetch,
    /// While building metadata, encountered something that should
    /// prohibit all metadata for the message from being built.
    /// Provides the reason for the refusal.
    Refused(String),
}
  • When we are building metadata and encounter a reorg flag in a validator that's used by the message, we handle this and return Metadata::MetadataBuildingRefused. The aggregation ISM will propagate this to make sure that we have end behavior of flatly refusing to build metadata for a message even if a nested metadata builder encounters this. If this happens, a new reprepare reason MessageMetadataRefused is introduced that's used.
  • e2e test is added to confirm this behavior

Drive-by changes

Related issues

Backward compatibility

Testing

e2e, some unit

Copy link

changeset-bot bot commented Feb 7, 2025

⚠️ No Changeset found

Latest commit: fa15cd6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.53%. Comparing base (ff874be) to head (420b059).
Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5401   +/-   ##
=======================================
  Coverage   77.53%   77.53%           
=======================================
  Files         103      103           
  Lines        2110     2110           
  Branches      190      190           
=======================================
  Hits         1636     1636           
  Misses        453      453           
  Partials       21       21           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 79.39% <ø> (ø)
isms 83.68% <ø> (ø)
token 91.27% <ø> (ø)
middlewares 79.80% <ø> (ø)

rust/main/agents/relayer/src/msg/metadata/aggregation.rs Outdated Show resolved Hide resolved
rust/main/agents/relayer/src/msg/metadata/base.rs Outdated Show resolved Hide resolved
rust/main/agents/relayer/src/msg/metadata/aggregation.rs Outdated Show resolved Hide resolved
rust/main/utils/run-locally/src/main.rs Show resolved Hide resolved
rust/main/hyperlane-base/src/settings/checkpoint_syncer.rs Outdated Show resolved Hide resolved
rust/main/utils/run-locally/src/main.rs Outdated Show resolved Hide resolved
@daniel-savu daniel-savu added this pull request to the merge queue Feb 10, 2025
Merged via the queue into main with commit dfd9e9f Feb 10, 2025
48 checks passed
@daniel-savu daniel-savu deleted the trevor/relayer-reorg-detection branch February 10, 2025 19:19
github-merge-queue bot pushed a commit that referenced this pull request Feb 10, 2025
to include fixes from
#5401 and
#5416
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants