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

[evm] enable cancun at Vanuatu #4369

Merged
merged 14 commits into from
Sep 26, 2024
Prev Previous commit
Next Next commit
settle cancun context
  • Loading branch information
envestcc committed Sep 25, 2024
commit 6298bfdc24c8a5c4df3bde80a2f24102d29064a9
19 changes: 14 additions & 5 deletions action/protocol/execution/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"github.com/iotexproject/iotex-core/action"
"github.com/iotexproject/iotex-core/action/protocol"
"github.com/iotexproject/iotex-core/blockchain/block"
"github.com/iotexproject/iotex-core/blockchain/genesis"
"github.com/iotexproject/iotex-core/pkg/log"
"github.com/iotexproject/iotex-core/pkg/tracer"
Expand Down Expand Up @@ -166,6 +167,9 @@ func newParams(
// Random opcode (EIP-4399) is not supported
context.Random = &common.Hash{}
}
if g.IsVanuatu(blkCtx.BlockHeight) {
context.BlobBaseFee = new(big.Int).Set(&blkCtx.BlobBaseFee)
}

if vmCfg, ok := protocol.GetVMConfigCtx(ctx); ok {
vmConfig = vmCfg
Expand All @@ -174,13 +178,17 @@ func newParams(
if err != nil {
return nil, err
}

vmTxCtx := vm.TxContext{
Origin: executorAddr,
GasPrice: execution.GasPrice(),
}
if g.IsVanuatu(blkCtx.BlockHeight) {
vmTxCtx.BlobHashes = execution.BlobHashes()
vmTxCtx.BlobFeeCap = execution.BlobGasFeeCap()
}
return &Params{
context,
vm.TxContext{
Origin: executorAddr,
GasPrice: execution.GasPrice(),
},
vmTxCtx,
execution.Nonce(),
execution.Value(),
execution.To(),
Expand Down Expand Up @@ -623,6 +631,7 @@ func SimulateExecution(
BlockTimeStamp: bcCtx.Tip.Timestamp.Add(g.BlockInterval),
GasLimit: g.BlockGasLimitByHeight(bcCtx.Tip.Height + 1),
Producer: zeroAddr,
BlobBaseFee: *block.CalcBlobFee(bcCtx.Tip.ExcessBlobGas),
},
)

Expand Down