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

Add configuration to filter fee packets using recv fee as criteria #3133

Merged
merged 26 commits into from
Mar 3, 2023

Conversation

ljoss17
Copy link
Contributor

@ljoss17 ljoss17 commented Mar 2, 2023

Closes: #1966

Description

This PR adds a new configuration to Hermes which allows users to relay only incentivized packets or incentivized packets which have at least a specific threshold as recv_fee.
This configuration can be done per channel.

New configuration

The new configuration per chain:

[chains.packet_filter.min_fees.'<channel>']
  recv    = [ { amount = <amount>, denom = '<denom>' } ]

The channel can be specified using regular expression matching, so to have a filter for all channels:

[chains.packet_filter.min_fees.'*']
  recv    = [ { amount = <amount>, denom = '<denom>' } ]

The denom is optional. If it is specified the packet must have a recv_fee with one of the specified denoms. For example this filter will only relay packets which have at least 20 utatom or 10 stake as recv_fee:

[chains.packet_filter.min_fees.'*']
  recv    = [ { amount = 20, denom = 'stake' }, { amount = 10, denom = 'uatom' } ]

And this will relay any packet which has at least 20 utatom, 10 stake or at least 50 of any token:

[chains.packet_filter.min_fees.'*']
  recv    = [  { amount = 20, denom = 'stake' }, { amount = 10, denom = 'uatom' }, { amount = 50} ]

recv_fee only

This solution only allows to filter SendPacket events if they do not have recv_fee or if the fee isn't high enough.
This choice has been made since allowing to filter acknowledgement and timeout would introduce much more overhead. And the if no acknowledgement or timeout is relayed, the fees will not be distributed and unescrowed.

Remarks

This configuration is experimental. Packet clearing is disabled for the channels which have a fee filter configured, and some SendPacket events might not be relayed if the IncentivizedPacket event is not in the same batch of events.


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@ljoss17 ljoss17 added O: new-feature Objective: cause to add a new feature or support I: configuration Internal: related to Hermes configuration O: ics29-fee Objective: Fee middleware support labels Mar 2, 2023
@ljoss17 ljoss17 requested a review from romac March 2, 2023 10:15
@ljoss17 ljoss17 marked this pull request as ready for review March 2, 2023 11:08
Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @ljoss17! Overall it looks really good, left a bunch of minor requests and comments.

config.toml Outdated Show resolved Hide resolved
config.toml Outdated Show resolved Hide resolved
config.toml Outdated Show resolved Hide resolved
crates/relayer-cli/src/chain_registry.rs Outdated Show resolved Hide resolved
crates/relayer/src/config/filter.rs Outdated Show resolved Hide resolved
tools/integration-test/src/tests/fee/filter_fees.rs Outdated Show resolved Hide resolved
@romac romac merged commit a74ea5c into master Mar 3, 2023
@romac romac deleted the luca_joss/ics29_filter_fee_packets_using_recv_fee_only branch March 3, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: configuration Internal: related to Hermes configuration O: ics29-fee Objective: Fee middleware support O: new-feature Objective: cause to add a new feature or support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow packet filtering based on whether packet contains relaying fee
2 participants