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

[evm] implement EIP-3529 #3226

Merged
merged 3 commits into from
Mar 29, 2022
Merged

[evm] implement EIP-3529 #3226

merged 3 commits into from
Mar 29, 2022

Conversation

dustinxie
Copy link
Member

Description

here's the Ethereum implementation: ethereum/go-ethereum#22733

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • make test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@dustinxie dustinxie requested a review from a team as a code owner March 23, 2022 23:54
@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #3226 (5bb53b6) into master (015527d) will decrease coverage by 0.01%.
The diff coverage is 14.28%.

@@            Coverage Diff             @@
##           master    #3226      +/-   ##
==========================================
- Coverage   74.97%   74.95%   -0.02%     
==========================================
  Files         228      228              
  Lines       21367    21373       +6     
==========================================
+ Hits        16019    16020       +1     
- Misses       4488     4493       +5     
  Partials      860      860              
Impacted Files Coverage Δ
action/protocol/execution/evm/evm.go 46.33% <14.28%> (-0.54%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 015527d...5bb53b6. Read the comment docs.

@@ -395,7 +398,11 @@ func executeInEVM(ctx context.Context, evmParams *Params, stateDB *StateDBAdapte
if stateDB.Error() != nil {
log.L().Debug("statedb error", zap.Error(stateDB.Error()))
}
refund := (evmParams.gas - remainingGas) / 2
if !london {
Copy link
Member

Choose a reason for hiding this comment

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

where is old code (evmParams.gas - remainingGas) / 2

Copy link
Member Author

@dustinxie dustinxie Mar 24, 2022

Choose a reason for hiding this comment

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

next line
params.RefundQuotient = 2

Copy link
Member

Choose a reason for hiding this comment

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

what if params.RefundQuotient is changed?

Copy link
Member Author

@dustinxie dustinxie Mar 25, 2022

Choose a reason for hiding this comment

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

check Ethereum implementation: ethereum/go-ethereum#22733

Ethereum needs to keep the change backward-compatible (just like us), so this won't change, otherwise past blocks won't be able to sync?

Copy link
Member

Choose a reason for hiding this comment

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

ok. Could you add the comment like theirs?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -395,7 +398,11 @@ func executeInEVM(ctx context.Context, evmParams *Params, stateDB *StateDBAdapte
if stateDB.Error() != nil {
log.L().Debug("statedb error", zap.Error(stateDB.Error()))
}
refund := (evmParams.gas - remainingGas) / 2
if !london {
Copy link
Member

Choose a reason for hiding this comment

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

ok. Could you add the comment like theirs?

@@ -365,8 +366,10 @@ func executeInEVM(ctx context.Context, evmParams *Params, stateDB *StateDBAdapte
var (
contractRawAddress = action.EmptyAddress
executor = vm.AccountRef(evmParams.txCtx.Origin)
london = evm.ChainConfig().IsLondon(evm.Context.BlockNumber)
Copy link
Member

Choose a reason for hiding this comment

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

isLondon

Copy link
Member Author

Choose a reason for hiding this comment

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

london is used in our go-ethereum v0.4.0, would like to keep it the same

@dustinxie dustinxie merged commit 60f6f05 into iotexproject:master Mar 29, 2022
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