Skip to content

Commit 1998533

Browse files
authored
Merge pull request #8085 from onflow/mpeter/enable-testnet-fusaka-hard-fork
Enable EVM Fusaka hard-fork for `PreviewNet` (a.k.a Emulator) & `Testnet`
2 parents 4df61ad + 5f1b1db commit 1998533

File tree

16 files changed

+464
-51
lines changed

16 files changed

+464
-51
lines changed

fvm/evm/emulator/config.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ var (
2121
PreviewnetPragueActivation = uint64(0) // already on Prague for PreviewNet
2222
TestnetPragueActivation = uint64(1746723600) // Thu May 08 2025 17:00:00 GMT+0000 (10am PDT)
2323
MainnetPragueActivation = uint64(1747328400) // Thu May 15 2025 17:00:00 GMT+0000 (10am PDT)
24+
25+
PreviewnetOsakaActivation = uint64(0) // already on Osaka for PreviewNet
26+
TestnetOsakaActivation = uint64(1763575200) // Wednesday, November 19, 2025 18:00:00 GMT+0000
27+
MainnetOsakaActivation = uint64(1764784800) // Wednesday, December 03, 2025 18:00:00 GMT+0000
2428
)
2529

2630
// Config aggregates all the configuration (chain, evm, block, tx, ...)
@@ -101,15 +105,19 @@ func MakeChainConfig(chainID *big.Int) *gethParams.ChainConfig {
101105
ShanghaiTime: &zero, // already on Shanghai
102106
CancunTime: &zero, // already on Cancun
103107
PragueTime: nil, // this is conditionally set below
108+
OsakaTime: nil, // this is conditionally set below
104109
VerkleTime: nil, // not on Verkle
105110
}
106111

107112
if chainID.Cmp(types.FlowEVMPreviewNetChainID) == 0 {
108113
chainConfig.PragueTime = &PreviewnetPragueActivation
114+
chainConfig.OsakaTime = &PreviewnetOsakaActivation
109115
} else if chainID.Cmp(types.FlowEVMTestNetChainID) == 0 {
110116
chainConfig.PragueTime = &TestnetPragueActivation
117+
chainConfig.OsakaTime = &TestnetOsakaActivation
111118
} else if chainID.Cmp(types.FlowEVMMainNetChainID) == 0 {
112119
chainConfig.PragueTime = &MainnetPragueActivation
120+
chainConfig.OsakaTime = &MainnetOsakaActivation
113121
}
114122

115123
return chainConfig

fvm/evm/emulator/emulator.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package emulator
22

33
import (
44
"errors"
5+
"fmt"
56
"math/big"
67

78
gethCommon "github.com/ethereum/go-ethereum/common"
89
gethCore "github.com/ethereum/go-ethereum/core"
9-
"github.com/ethereum/go-ethereum/core/tracing"
1010
gethTracing "github.com/ethereum/go-ethereum/core/tracing"
1111
gethTypes "github.com/ethereum/go-ethereum/core/types"
1212
gethVM "github.com/ethereum/go-ethereum/core/vm"
@@ -120,6 +120,22 @@ func (bl *BlockView) DirectCall(call *types.DirectCall) (res *types.Result, err
120120
// Set the nonce for the call (needed for some operations like deployment)
121121
call.Nonce = proc.state.GetNonce(call.From.ToCommon())
122122

123+
if !call.ValidEIP7825GasLimit(proc.config.ChainRules()) {
124+
res := &types.Result{
125+
TxType: call.Type,
126+
TxHash: call.Hash(),
127+
}
128+
res.SetValidationError(
129+
fmt.Errorf(
130+
"%w (cap: %d, tx: %d)",
131+
gethCore.ErrGasLimitTooHigh,
132+
gethParams.MaxTxGas,
133+
call.GasLimit,
134+
),
135+
)
136+
return res, nil
137+
}
138+
123139
// Call tx tracer
124140
if proc.evm.Config.Tracer != nil && proc.evm.Config.Tracer.OnTxStart != nil {
125141
proc.evm.Config.Tracer.OnTxStart(proc.evm.GetVMContext(), call.Transaction(), call.From.ToCommon())
@@ -596,7 +612,7 @@ func (proc *procedure) deployAt(
596612
res.DeployedContractAddress = &call.To
597613
res.CumulativeGasUsed = proc.config.BlockTotalGasUsedSoFar + res.GasConsumed
598614

599-
proc.state.SetCode(addr, ret, tracing.CodeChangeContractCreation)
615+
proc.state.SetCode(addr, ret, gethTracing.CodeChangeContractCreation)
600616
res.StateChangeCommitment, err = proc.commit(true)
601617
return res, err
602618
}

fvm/evm/emulator/emulator_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package emulator_test
33
import (
44
"encoding/hex"
55
"fmt"
6-
"math"
76
"math/big"
87
"strings"
98
"testing"
@@ -211,7 +210,7 @@ func TestContractInteraction(t *testing.T) {
211210
call := types.NewDeployCall(
212211
testAccount,
213212
testContract.ByteCode,
214-
math.MaxUint64,
213+
gethParams.MaxTxGas,
215214
amountToBeTransfered,
216215
testAccountNonce)
217216
res, err := blk.DirectCall(call)
@@ -599,7 +598,7 @@ func TestDeployAtFunctionality(t *testing.T) {
599598
testAccount,
600599
target,
601600
testContract.ByteCode,
602-
math.MaxUint64,
601+
gethParams.MaxTxGas,
603602
amountToBeTransfered,
604603
0,
605604
),
@@ -629,7 +628,7 @@ func TestDeployAtFunctionality(t *testing.T) {
629628
testAccount,
630629
target,
631630
testContract.ByteCode,
632-
math.MaxUint64,
631+
gethParams.MaxTxGas,
633632
amountToBeTransfered,
634633
0),
635634
)
@@ -687,7 +686,7 @@ func TestSelfdestruct(t *testing.T) {
687686
types.NewDeployCall(
688687
testAddress,
689688
testContract.ByteCode,
690-
math.MaxUint64,
689+
gethParams.MaxTxGas,
691690
deployBalance,
692691
0),
693692
)
@@ -768,7 +767,7 @@ func TestFactoryPatterns(t *testing.T) {
768767
types.NewDeployCall(
769768
factoryDeployer,
770769
factoryContract.ByteCode,
771-
math.MaxUint64,
770+
gethParams.MaxTxGas,
772771
factoryBalance,
773772
0),
774773
)

0 commit comments

Comments
 (0)