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

core/vm: set basefee to 0 internally on eth_call #28470

Merged
merged 8 commits into from
Nov 8, 2023
Merged
2 changes: 1 addition & 1 deletion core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func (st *StateTransition) preCheck() error {
if st.evm.ChainConfig().IsCancun(st.evm.Context.BlockNumber, st.evm.Context.Time) {
if st.blobGasUsed() > 0 {
// Skip the checks if gas fields are zero and blobBaseFee was explicitly disabled (eth_call)
if !st.evm.Config.NoBaseFee && msg.BlobGasFeeCap.BitLen() > 0 {
if !st.evm.Config.NoBaseFee || msg.BlobGasFeeCap.BitLen() > 0 {
Copy link
Contributor

@holiman holiman Nov 7, 2023

Choose a reason for hiding this comment

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

I had to, again, look at it for a while before my brain parsed it out fully. Yeah it's ok now, but I'd prefer having it rewritten for clarity:

// skip checks if basefee was disabled and blobBaseFee is zero (eth_call) 
skipCheck := st.evm.Config.NoBaseFee && msg.BlobGasFeeCap.BitLen() == 0
if !skipCheck {

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed this fix and also added it to the 1559 basefee

if l := msg.BlobGasFeeCap.BitLen(); l > 256 {
return fmt.Errorf("%w: address %v, blobGasFeeCap bit length: %d", ErrFeeCapVeryHigh,
msg.From.Hex(), l)
Expand Down