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

Allow lowering of basefee to 0 if vm runs with NoBaseFee flag and 0 gas price #324

Merged
merged 6 commits into from
Jun 18, 2024
7 changes: 4 additions & 3 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ type BlockContext struct {
Random *common.Hash // Provides information for PREVRANDAO

// Arbitrum information
ArbOSVersion uint64
ArbOSVersion uint64
BaseFeeInBlock *big.Int // Copy of BaseFee to be used in arbitrum's geth hooks and precompiles when BaseFee is lowered to 0 when vm runs with NoBaseFee flag and 0 gas price. Is nil when BaseFee isn't lowered to 0
}

// TxContext provides the EVM with information about a transaction.
Expand Down Expand Up @@ -141,8 +142,8 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
// gas prices were specified, lower the basefee to 0 to avoid breaking EVM
// invariants (basefee < feecap)
if config.NoBaseFee {
// Currently we don't set block context's BaseFee to zero, since nitro uses this field
if txCtx.GasPrice.BitLen() == 0 && !chainConfig.IsArbitrum() {
if txCtx.GasPrice.BitLen() == 0 {
blockCtx.BaseFeeInBlock = new(big.Int).Set(blockCtx.BaseFee)
blockCtx.BaseFee = new(big.Int)
}
if txCtx.BlobFeeCap != nil && txCtx.BlobFeeCap.BitLen() == 0 {
Expand Down
Loading