-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
EIP-1559 implementation #22617
EIP-1559 implementation #22617
Conversation
7489ab6
to
37a7845
Compare
func (tx *DynamicFeeTx) gas() uint64 { return tx.Gas } | ||
func (tx *DynamicFeeTx) feeCap() *big.Int { return tx.FeeCap } | ||
func (tx *DynamicFeeTx) tip() *big.Int { return tx.Tip } | ||
func (tx *DynamicFeeTx) gasPrice() *big.Int { return tx.Tip } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the best way to handle gasPrice
in DynamicFeeTx
. It seems like there are 3 options:
- use
tx.Tip
as it still conveys the "urgency" like `gasPrice - use a sentinel value (e.g.
0
) - refactor tx interface to be better "typed" (e.g.
DynamicFeeTx
simply does not have gas price as a method)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed it in triage call and it should return tx.FeeCap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor nitpicks. Looks pretty good, thank you!
I'll do some more in-depth testing soonish
@@ -92,6 +173,7 @@ type headerMarshaling struct { | |||
GasUsed hexutil.Uint64 | |||
Time hexutil.Uint64 | |||
Extra hexutil.Bytes | |||
BaseFee *hexutil.Big |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to regenerate the headerMarshalling
in core/types/gen_header_json.go
See https://github.com/ledgerwatch/turbo-geth/pull/1834/files -- we need something similar applied here too, right? |
^ here |
And for the miner-part (another PR?), if w.current.gasPool == nil {
w.current.gasPool = new(core.GasPool).AddGas(w.current.header.GasLimit)
}
gaspool.AddGas(pre.Env.GasLimit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (see my comments for minor nitpicks)
core/state_transition.go
Outdated
} | ||
case isAleut && st.evm.Context.BaseFee == nil: | ||
return fmt.Errorf("baseFee missing") | ||
case !isAleut && st.evm.Context.BaseFee != nil: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking back at this, do people think it makes sense to check that if EIP-1559 is not enable then the basefee
should be nil
? Can't seem to find it now, but I recall someone mentioning that they weren't fond of the BASEFEE
op potentially dereferencing nil
if somehow it made it past the fork checks and included the op in the jump table.
The reason I'm coming back to this is it seems t8n
circumvents some of the code in state_processor
so it can create blocks with no nil
basefee
even if Aleut
is configured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the errors here are named errors, like ErrNonceTooHigh
, so the outer calller can do errors.Is(err, ErrNonceTooHigh)
. I think we should define these errors too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See core/state_processor_test.go
: TestStateProcessorErrors
. We should extend those tests for these cases.
if err := misc.VerifyEip1559Header(chain.Config(), parent, header); err != nil { | ||
return err | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to also have an else-block to verify that the header does not have a basefee. And I don't quite get why there's no corresponding if header.GasUsed > header.GasLimit
for clique (I mean previously) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll add this.
Not sure why that check wasn't here previously though. Should I add it?
24346e7
to
f6a9d64
Compare
Closing in favor of #22837 |
I'm opening this PR to track the consensus changes for EIP-1559. Updates to non-consensus code has been started and will be opened in another PR. This is a WIP.