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

fix(ampd): skip events from unknown contracts #259

Merged
merged 7 commits into from
Feb 13, 2024

Conversation

cjcobb23
Copy link
Contributor

@cjcobb23 cjcobb23 commented Feb 7, 2024

The handlers currently return an error when encountering an event with the same event_type as what they are looking for, but with different fields. This can happen due to contract upgrades, but also if any random contract emits an event with the same event_type as the event the handler cares about. This can cause either crashing the process, or unnecessary retries (and waiting).

This PR makes a change so that the handlers first check the "_contract_address" field of the event, and simply skip the event (returning Ok(()) ) if the address doesn't match the contract address for which the handler is configured to handle events.

https://axelarnetwork.atlassian.net/browse/AXE-3080

@cjcobb23 cjcobb23 requested a review from a team as a code owner February 7, 2024 17:07
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (69e7bf0) 89.72% compared to head (6f64cae) 89.77%.

Files Patch % Lines
ampd/src/handlers/multisig.rs 96.92% 2 Missing ⚠️
ampd/src/handlers/evm_verify_msg.rs 66.66% 1 Missing ⚠️
ampd/src/handlers/evm_verify_worker_set.rs 66.66% 1 Missing ⚠️
ampd/src/handlers/sui_verify_worker_set.rs 66.66% 1 Missing ⚠️
packages/events/src/event.rs 98.46% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #259      +/-   ##
==========================================
+ Coverage   89.72%   89.77%   +0.04%     
==========================================
  Files         161      161              
  Lines       16653    16765     +112     
==========================================
+ Hits        14942    15050     +108     
- Misses       1711     1715       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ampd/src/handlers/multisig.rs Outdated Show resolved Hide resolved
ampd/src/handlers/multisig.rs Show resolved Hide resolved
ampd/src/handlers/multisig.rs Outdated Show resolved Hide resolved
packages/events/src/event.rs Outdated Show resolved Hide resolved
packages/events/src/event.rs Outdated Show resolved Hide resolved
packages/events/src/event.rs Outdated Show resolved Hide resolved
ampd/src/handlers/multisig.rs Outdated Show resolved Hide resolved
@cjcobb23 cjcobb23 merged commit c26a374 into main Feb 13, 2024
7 checks passed
@cjcobb23 cjcobb23 deleted the skip_events_diff_contract branch February 13, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants