Skip to content

Commit

Permalink
Merge pull request #324 from OffchainLabs/allow-zeroing-blockctxbasefee
Browse files Browse the repository at this point in the history
Allow lowering of basefee to 0 if vm runs with NoBaseFee flag and 0 gas price
  • Loading branch information
ganeshvanahalli authored Jun 18, 2024
2 parents a0ac9d5 + b85c247 commit ed3aa85
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit ed3aa85

Please sign in to comment.