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

[Flow EVM] add testnet chainID #5527

Merged
merged 2 commits into from
Mar 12, 2024
Merged
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
2 changes: 1 addition & 1 deletion fvm/evm/emulator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c *Config) ChainRules() gethParams.Rules {
// and set a proper height for the specific release based on the Flow EVM heights
// so it could gets activated at a desired time.
var DefaultChainConfig = &gethParams.ChainConfig{
ChainID: types.FlowEVMTestnetChainID, // default is testnet
ChainID: types.FlowEVMPreviewNetChainID,

// Fork scheduling based on block heights
HomesteadBlock: bigZero,
Expand Down
4 changes: 2 additions & 2 deletions fvm/evm/emulator/emulator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func TestContractInteraction(t *testing.T) {
nonce += 1

ret := new(big.Int).SetBytes(res.ReturnedValue)
require.Equal(t, types.FlowEVMTestnetChainID, ret)
require.Equal(t, types.FlowEVMPreviewNetChainID, ret)
})
})

Expand Down Expand Up @@ -328,7 +328,7 @@ func TestContractInteraction(t *testing.T) {
tx := account.SignTx(
t,
gethTypes.NewTx(&gethTypes.DynamicFeeTx{
ChainID: types.FlowEVMTestnetChainID,
ChainID: types.FlowEVMPreviewNetChainID,
Nonce: account.Nonce(),
GasTipCap: big.NewInt(2),
GasFeeCap: big.NewInt(3),
Expand Down
18 changes: 11 additions & 7 deletions fvm/evm/types/chainIDs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ import (
)

var (
FlowEVMTestnetChainID = big.NewInt(646)
FlowEVMMainnetChainID = big.NewInt(747)
FlowEVMPreviewNetChainID = big.NewInt(646)
FlowEVMTestNetChainID = big.NewInt(545)
FlowEVMMainNetChainID = big.NewInt(747)
)

func EVMChainIDFromFlowChainID(flowChainID flow.ChainID) *big.Int {
// default evm chain ID is testnet
chainID := FlowEVMTestnetChainID
if flowChainID == flow.Mainnet {
chainID = FlowEVMMainnetChainID
// default evm chain ID is previewNet
switch flowChainID {
case flow.Mainnet:
return FlowEVMMainNetChainID
case flow.Testnet:
return FlowEVMTestNetChainID
default:
return FlowEVMPreviewNetChainID
}
return chainID
}
2 changes: 1 addition & 1 deletion fvm/evm/types/emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type BlockContext struct {
// NewDefaultBlockContext returns a new default block context
func NewDefaultBlockContext(BlockNumber uint64) BlockContext {
return BlockContext{
ChainID: FlowEVMTestnetChainID,
ChainID: FlowEVMPreviewNetChainID,
BlockNumber: BlockNumber,
DirectCallBaseGasUsage: DefaultDirectCallBaseGasUsage,
DirectCallGasPrice: DefaultDirectCallGasPrice,
Expand Down
Loading