Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Minimum GasUsed proportional to GasLimit #1087

Merged
merged 20 commits into from
May 25, 2022
Merged

Conversation

crypto-facs
Copy link
Contributor

@crypto-facs crypto-facs commented May 18, 2022

Closes: #1085

Description

More info about this issue on the issue, but in summary this PR aims to add a new functionality on which to control the minimum amount of gas to be charged proportional to the GasLimit of the transaction. The equation is the following:

max(gasUsed, gasLimit / MinGasDenominator)

MinGasDenominator being an EVM module param for the minimum about to be charged to be able to be updated as the network changes.

NOTE: This is a breaking change


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #1087 (03bbfbc) into main (f06df8c) will increase coverage by 0.01%.
The diff coverage is 73.21%.

❗ Current head 03bbfbc differs from pull request most recent head fc5561f. Consider uploading reports for the commit fc5561f to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1087      +/-   ##
==========================================
+ Coverage   59.55%   59.57%   +0.01%     
==========================================
  Files          84       85       +1     
  Lines        6933     6971      +38     
==========================================
+ Hits         4129     4153      +24     
- Misses       2591     2601      +10     
- Partials      213      217       +4     
Impacted Files Coverage Δ
x/evm/keeper/migrations.go 66.66% <0.00%> (-33.34%) ⬇️
x/evm/migrations/v2/migration.go 42.85% <42.85%> (ø)
x/evm/module.go 52.85% <60.00%> (-0.88%) ⬇️
x/evm/types/params.go 93.47% <81.81%> (-6.53%) ⬇️
x/evm/keeper/state_transition.go 75.37% <87.50%> (+0.30%) ⬆️
x/evm/simulation/genesis.go 93.54% <100.00%> (ø)

Copy link
Contributor

@danburck danburck left a comment

Choose a reason for hiding this comment

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

@crypto-facs LGMT, left minor comments.

Do you think it makes sense to add unit tests here?

proto/ethermint/evm/v1/evm.proto Outdated Show resolved Hide resolved
x/evm/types/params_test.go Outdated Show resolved Hide resolved
x/evm/types/params_test.go Outdated Show resolved Hide resolved
x/evm/keeper/state_transition.go Outdated Show resolved Hide resolved
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Thanks @crypto-facs! Changes LGTM. Some things pending:

  • tests to check that the multiplier logic works as intended
  • update specification
  • add migration logic to set the new parameter during upgrade
    • migration 1 -> 2 (consensus version of the evm module)
    • define migrator

go.sum Show resolved Hide resolved
x/evm/keeper/state_transition.go Outdated Show resolved Hide resolved
x/evm/types/params.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

LGTM, minor change requested

x/evm/types/params.go Outdated Show resolved Hide resolved
@fedekunze fedekunze requested a review from danburck May 25, 2022 13:47
@fedekunze fedekunze enabled auto-merge (squash) May 25, 2022 13:48
@fedekunze fedekunze merged commit c441771 into evmos:main May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

don't refund all the unused gas
4 participants