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

update gas tip cap param range #1884

Merged
merged 3 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions x/evm/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
if txData.GetGasFeeCap().Cmp(fc.getMinimumFee(ctx)) < 0 {
return ctx, sdkerrors.ErrInsufficientFee
}
if txData.GetGasTipCap().Sign() < 0 {
return ctx, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "gas tip cap cannot be negative: %s", txData.GetGasTipCap())
}

Check warning on line 52 in x/evm/ante/fee.go

View check run for this annotation

Codecov / codecov/patch

x/evm/ante/fee.go#L51-L52

Added lines #L51 - L52 were not covered by tests

// if EVM version is Cancun or later, and the transaction contains at least one blob, we need to
// make sure the transaction carries a non-zero blob fee cap.
Expand Down
4 changes: 4 additions & 0 deletions x/evm/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
dtx := ethtx.DynamicFeeTx{}
if proto.Unmarshal(any.Value, &dtx) == nil {
// value is a dynamic fee tx
// check gas tip cap non-negative
if dtx.GasTipCap.Sign() < 0 {
return nil, fmt.Errorf("gas tip cap cannot be negative: %s", dtx.GasTipCap)
}

Check warning on line 100 in x/evm/types/codec.go

View check run for this annotation

Codecov / codecov/patch

x/evm/types/codec.go#L97-L100

Added lines #L97 - L100 were not covered by tests
return &dtx, nil
}
btx := ethtx.BlobTx{}
Expand Down
Loading