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

eth_call/eth_estimateGas don't need to pass base fee externally #671

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Oct 14, 2021

Solution:

  • load fee directly from state

Description


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)

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.

changes LGTM, one question only. Can you also fix the linter issue and add a changelog entry?


// ignore base fee if not enabled by fee market params
if !feemktParams.NoBaseFee {
if types.IsLondon(ethCfg, ctx.BlockHeight()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

are we not checking the fee market param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I’m not sure what’s standard way to check for this, I copied the logic from existing code, should we check both?

Copy link
Contributor

@thomas-nguy thomas-nguy Oct 14, 2021

Choose a reason for hiding this comment

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

from what I have compiled so far

For not a london block -> block base fee should be nil, tx basefee should also be nil

For london block

  • if its under market fee activation height or nobasefee is true -> block base fee is equal to marketfee.basefee. Should we support EIP-1559 and use marketfee.basefee value or should we ignore it?
  • if its above activation height and nobasefee is false -> block base fee is dynamically computed and tx base fee should uses previousheader.basefee

If under activation height or no base fee means that we should use static value marketfee.basefee then just checking IsLondon is enough there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I noticed that some part of the code does not follow the same logic:
https://github.com/tharsis/ethermint/blob/main/app/ante/eth.go#L362

I think we need some clarification @fedekunze about the spec for this baseFee

London not activated => baseFee value?
London activated, FeeMarket not enabled or height activation not reached = baseFee value?
London activated, FeeMarket enabled and height activation reached = baseFee value?

Copy link
Contributor

Choose a reason for hiding this comment

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

the idea of having the parameter was to make the module available for other chains too. Maybe we could remove the feemarket parameters and just have an imported module interface that has a single IsBaseFeeEnabled(ctx) func.

I can create an issue for it, so you can ignore it for this PR

@@ -319,7 +308,10 @@ func (k Keeper) EstimateGas(c context.Context, req *types.EthCallRequest) (*type
return nil, status.Error(codes.Internal, err.Error())
}

baseFee := req.GetBaseFee()
var baseFee *big.Int
if types.IsLondon(ethCfg, ctx.BlockHeight()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto fee market param check

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.

ACK, pending lint fix and changelog entry. I can remove the fee market params in another PR

Solution:
- load fee directly from state

changelog
@codecov
Copy link

codecov bot commented Oct 21, 2021

Codecov Report

Merging #671 (485d4d6) into main (f70e4c1) will increase coverage by 0.15%.
The diff coverage is 36.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #671      +/-   ##
==========================================
+ Coverage   57.23%   57.38%   +0.15%     
==========================================
  Files          64       64              
  Lines        5596     5583      -13     
==========================================
+ Hits         3203     3204       +1     
+ Misses       2228     2215      -13     
+ Partials      165      164       -1     
Impacted Files Coverage Δ
x/evm/types/query.go 0.00% <ø> (ø)
x/evm/keeper/grpc_query.go 62.07% <36.36%> (+1.51%) ⬆️

@yihuang
Copy link
Contributor Author

yihuang commented Oct 21, 2021

ACK, pending lint fix and changelog entry. I can remove the fee market params in another PR

done

@fedekunze fedekunze merged commit ac75a9a into evmos:main Oct 21, 2021
@yihuang yihuang deleted the basefee branch October 21, 2021 15:38
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.

3 participants