Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions fvm/evm/emulator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ var (
PreviewnetPragueActivation = uint64(0) // already on Prague for PreviewNet
TestnetPragueActivation = uint64(1746723600) // Thu May 08 2025 17:00:00 GMT+0000 (10am PDT)
MainnetPragueActivation = uint64(1747328400) // Thu May 15 2025 17:00:00 GMT+0000 (10am PDT)

PreviewnetFusakaActivation = uint64(0) // already on Fusaka for PreviewNet
TestnetFusakaActivation = uint64(1761695999) // Tuesday, October 28, 2025 11:59:59 PM
MainnetFusakaActivation = uint64(1764806399) // Wednesday, December 3, 2025 11:59:59 PM
)

// Config aggregates all the configuration (chain, evm, block, tx, ...)
Expand Down Expand Up @@ -100,6 +104,7 @@ func MakeChainConfig(chainID *big.Int) *gethParams.ChainConfig {
ShanghaiTime: &zero, // already on Shanghai
CancunTime: &zero, // already on Cancun
PragueTime: nil, // this is conditionally set below
OsakaTime: nil, // this is conditionally set below
VerkleTime: nil, // not on Verkle
}

Expand All @@ -111,6 +116,14 @@ func MakeChainConfig(chainID *big.Int) *gethParams.ChainConfig {
chainConfig.PragueTime = &MainnetPragueActivation
}

if chainID.Cmp(types.FlowEVMPreviewNetChainID) == 0 {
chainConfig.OsakaTime = &zero
} else if chainID.Cmp(types.FlowEVMTestNetChainID) == 0 {
chainConfig.OsakaTime = &TestnetFusakaActivation
} else if chainID.Cmp(types.FlowEVMMainNetChainID) == 0 {
chainConfig.OsakaTime = &MainnetFusakaActivation
}

return chainConfig
}

Expand Down
19 changes: 19 additions & 0 deletions fvm/evm/emulator/emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ package emulator

import (
"errors"
"fmt"
"math/big"

gethCommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
gethCore "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/tracing"
gethTracing "github.com/ethereum/go-ethereum/core/tracing"
gethTypes "github.com/ethereum/go-ethereum/core/types"
gethVM "github.com/ethereum/go-ethereum/core/vm"
gethCrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
gethParams "github.com/ethereum/go-ethereum/params"
"github.com/holiman/uint256"
"github.com/onflow/atree"
Expand Down Expand Up @@ -117,6 +120,22 @@ func (bl *BlockView) DirectCall(call *types.DirectCall) (res *types.Result, err
return nil, err
}

if (proc.config.BlockContext.Time >= *bl.config.ChainConfig.OsakaTime) && call.TxGasLimitEnabled() && (call.GasLimit > gethParams.MaxTxGas) {
res := &types.Result{
TxType: call.Type,
TxHash: call.Hash(),
}
res.SetValidationError(
fmt.Errorf(
"%w (cap: %d, tx: %d)",
core.ErrGasLimitTooHigh,
params.MaxTxGas,
call.GasLimit,
),
)
return res, nil
}

// Set the nonce for the call (needed for some operations like deployment)
call.Nonce = proc.state.GetNonce(call.From.ToCommon())

Expand Down
11 changes: 5 additions & 6 deletions fvm/evm/emulator/emulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package emulator_test
import (
"encoding/hex"
"fmt"
"math"
"math/big"
"strings"
"testing"
Expand Down Expand Up @@ -211,7 +210,7 @@ func TestContractInteraction(t *testing.T) {
call := types.NewDeployCall(
testAccount,
testContract.ByteCode,
math.MaxUint64,
gethParams.MaxTxGas,
amountToBeTransfered,
testAccountNonce)
res, err := blk.DirectCall(call)
Expand Down Expand Up @@ -599,7 +598,7 @@ func TestDeployAtFunctionality(t *testing.T) {
testAccount,
target,
testContract.ByteCode,
math.MaxUint64,
gethParams.MaxTxGas,
amountToBeTransfered,
0,
),
Expand Down Expand Up @@ -629,7 +628,7 @@ func TestDeployAtFunctionality(t *testing.T) {
testAccount,
target,
testContract.ByteCode,
math.MaxUint64,
gethParams.MaxTxGas,
amountToBeTransfered,
0),
)
Expand Down Expand Up @@ -687,7 +686,7 @@ func TestSelfdestruct(t *testing.T) {
types.NewDeployCall(
testAddress,
testContract.ByteCode,
math.MaxUint64,
gethParams.MaxTxGas,
deployBalance,
0),
)
Expand Down Expand Up @@ -768,7 +767,7 @@ func TestFactoryPatterns(t *testing.T) {
types.NewDeployCall(
factoryDeployer,
factoryContract.ByteCode,
math.MaxUint64,
gethParams.MaxTxGas,
factoryBalance,
0),
)
Expand Down
Loading