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

refactor: bypass-msgs #2218

Merged
merged 18 commits into from
Mar 17, 2023
Merged

refactor: bypass-msgs #2218

merged 18 commits into from
Mar 17, 2023

Conversation

yaruwangway
Copy link
Contributor

@yaruwangway yaruwangway commented Feb 17, 2023

closes: #2213
Issue description please check #2213

please note this is not the final refactor of bypass-msg, bypass-msg will go to store as global params.

@codecov
Copy link

codecov bot commented Feb 17, 2023

Codecov Report

Merging #2218 (4c991c3) into main (53a07ee) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2218      +/-   ##
==========================================
+ Coverage   83.83%   83.84%   +0.01%     
==========================================
  Files          22       22              
  Lines        1540     1541       +1     
==========================================
+ Hits         1291     1292       +1     
  Misses        201      201              
  Partials       48       48              
Impacted Files Coverage Δ
ante/ante.go 50.00% <100.00%> (ø)
app/app.go 75.65% <100.00%> (+0.21%) ⬆️
x/globalfee/ante/fee.go 87.87% <100.00%> (-0.13%) ⬇️
x/globalfee/ante/fee_utils.go 88.79% <100.00%> (ø)

// Otherwise, minimum fees and global fees are checked to prevent spam.
containsOnlyBypassMinFeeMsgs := mfd.bypassMinFeeMsgs(msgs)
doesNotExceedMaxGasUsage := gas <= uint64(len(msgs))*mfd.MaxBypassMinFeeMsgGasUsage
doesNotExceedMaxGasUsage := gas <= mfd.MaxTotalBypassMinFeeMsgGasUsage
allowedToBypassMinFee := containsOnlyBypassMinFeeMsgs && doesNotExceedMaxGasUsage
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @alexanderbez , can you please help confirm here, it is ok to refactor uint64(len(msgs))*mfd.MaxBypassMinFeeMsgGasUsage to MaxTotalBypassMinFeeMsgGasUsage ?
without upgrade

MaxBypassMinFeeMsgGasUsage is 200_000,
MaxTotalBypassMinFeeMsgGasUsage is 1_000_000

Copy link
Contributor

@alexanderbez alexanderbez Feb 21, 2023

Choose a reason for hiding this comment

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

No, you cannot change gas consumed in a soft upgrade (i.e. a point release). If a node is replaying or catching up, it will yield in a consensus fault (e.g. you said gas was X but it's Y for me)

Copy link
Contributor

Choose a reason for hiding this comment

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

Even if MaxTotalBypassMinFeeMsgGasUsage isn't checked in DeliverTx ?

// Only check for minimum fees and global fee if the execution mode is CheckTx
if !ctx.IsCheckTx() || simulate {
return next(ctx, tx, simulate)
}
if !allowedToBypassMinFee {

@yaruwangway yaruwangway mentioned this pull request Feb 21, 2023
11 tasks
@yaruwangway yaruwangway changed the title refactor: bypass-msgs refactor: bypass-msgs for v10 Feb 21, 2023
@yaruwangway yaruwangway mentioned this pull request Feb 22, 2023
@yaruwangway yaruwangway changed the title refactor: bypass-msgs for v10 refactor: bypass-msgs Mar 1, 2023
@yaruwangway yaruwangway mentioned this pull request Mar 1, 2023
@yaruwangway yaruwangway requested a review from ancazamfir March 1, 2023 11:54

Nodes created using Gaiad `v7.0.1` or earlier do not have `bypass-min-fee-msg-types` configured in `config/app.toml` - they are also using default values. The `bypass-min-fee-msg-types` config option can be added to `config/app.toml` before the `[telemetry]` field.
- Nodes created using Gaiad `v7.0.2` or later use `["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement","/ibc.applications.transfer.v1.MsgTransfer"]` as defaults.
- Nodes created using Gaiad `v9.0.1` or later use `["/ibc.core.channel.v1.MsgRecvPacket", "/ibc.core.channel.v1.MsgAcknowledgement","/ibc.applications.transfer.v1.MsgTransfer", "/ibc.core.channel.v1.MsgTimeout", "/ibc.core.channel.v1.MsgTimeoutOnClose"]` as defaults.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This version need to be updated, it will not be included in v9.0.1. This PR is consensus breaking.

Copy link

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

You can see our (Umee) ante handler implementation for bypassing fee for certain type (and max gas) of messages: https://github.com/umee-network/umee/blob/main/ante/fee.go#L22

@mergify
Copy link
Contributor

mergify bot commented Mar 15, 2023

⚠️ The sha of the head commit of this PR conflicts with #2259. Mergify cannot evaluate rules on this PR. ⚠️

ante/ante.go Show resolved Hide resolved
Copy link
Contributor

@sainoe sainoe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

Looks good but some changes are necessary. We should not drop NewGovPreventSpamDecorator.

ante/ante.go Show resolved Hide resolved
docs/modules/globalfee.md Outdated Show resolved Hide resolved
docs/modules/globalfee.md Outdated Show resolved Hide resolved
x/globalfee/ante/antetest/fee_test.go Show resolved Hide resolved
Yaru Wang and others added 3 commits March 16, 2023 11:29
@yaruwangway yaruwangway requested a review from MSalopek March 16, 2023 17:12
Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

Looks good!

Thank you for making the changes.

@yaruwangway yaruwangway merged commit 483fb4d into main Mar 17, 2023
@yaruwangway yaruwangway deleted the yaru/bypass-msg branch March 17, 2023 13:25
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.

refactor bypass-min-fee-msg-types
5 participants