From 2990bec95bee6f90b51204102a29f2cb1b087c50 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Fri, 23 Feb 2024 13:03:24 +0100 Subject: [PATCH 1/3] Mark previewnet as transient --- model/flow/chain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/flow/chain.go b/model/flow/chain.go index c5a950e0060..1a17e5a164e 100644 --- a/model/flow/chain.go +++ b/model/flow/chain.go @@ -59,7 +59,7 @@ func AllChainIDs() ChainIDList { // Transient returns whether the chain ID is for a transient network. func (c ChainID) Transient() bool { - return c == Emulator || c == Localnet || c == Benchnet || c == BftTestnet + return c == Emulator || c == Localnet || c == Benchnet || c == BftTestnet || c == Previewnet } // getChainCodeWord derives the network type used for address generation from the globally From 282c04375a13890b67ef1b65dafa99be79f9ebc4 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Fri, 23 Feb 2024 13:27:52 +0100 Subject: [PATCH 2/3] account for extra address created durring bootstrapping --- cmd/bootstrap/cmd/finalize.go | 2 ++ cmd/bootstrap/utils/key_generation.go | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/bootstrap/cmd/finalize.go b/cmd/bootstrap/cmd/finalize.go index 7faee8967f4..a1a68fbd005 100644 --- a/cmd/bootstrap/cmd/finalize.go +++ b/cmd/bootstrap/cmd/finalize.go @@ -586,6 +586,8 @@ func generateEmptyExecutionState( fvm.WithStorageMBPerFLOW(fvm.DefaultStorageMBPerFLOW), fvm.WithEpochConfig(epochConfig), fvm.WithIdentities(identities), + // TODO (JanezP): set this as a default during bootstrapping + fvm.WithSetupEVMEnabled(true), ) if err != nil { log.Fatal().Err(err).Msg("unable to generate execution state") diff --git a/cmd/bootstrap/utils/key_generation.go b/cmd/bootstrap/utils/key_generation.go index 1857bf34eee..eef9532760d 100644 --- a/cmd/bootstrap/utils/key_generation.go +++ b/cmd/bootstrap/utils/key_generation.go @@ -13,6 +13,7 @@ import ( sdk "github.com/onflow/flow-go-sdk" sdkcrypto "github.com/onflow/flow-go-sdk/crypto" + "github.com/onflow/flow-go/fvm/systemcontracts" "github.com/onflow/flow-go/model/bootstrap" "github.com/onflow/flow-go/model/encodable" "github.com/onflow/flow-go/model/flow" @@ -173,7 +174,7 @@ func WriteMachineAccountFiles(chainID flow.ChainID, nodeInfos []bootstrap.NodeIn // // for the machine account key, we keep track of the address index to map // the Flow address of the machine account to the key. - addressIndex := uint64(4) + addressIndex := uint64(systemcontracts.EVMStorageAccountIndex) for _, nodeInfo := range nodeInfos { // retrieve private representation of the node @@ -188,7 +189,7 @@ func WriteMachineAccountFiles(chainID flow.ChainID, nodeInfos []bootstrap.NodeIn // Accounts are generated in a known order during bootstrapping, and // account addresses are deterministic based on order for a given chain // configuration. During the bootstrapping we create 4 Flow accounts besides - // the service account (index 0) so node accounts will start at index 5. + // the service account (index 1) so node accounts will start at index 6. // // All nodes have a staking account created for them, only collection and // consensus nodes have a second machine account created. From caffec0124883edcf5baa808a345dffba1dd84de Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Mon, 26 Feb 2024 18:37:17 +0100 Subject: [PATCH 3/3] revert EVM related changes --- cmd/bootstrap/cmd/finalize.go | 2 -- cmd/bootstrap/utils/key_generation.go | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/bootstrap/cmd/finalize.go b/cmd/bootstrap/cmd/finalize.go index a1a68fbd005..7faee8967f4 100644 --- a/cmd/bootstrap/cmd/finalize.go +++ b/cmd/bootstrap/cmd/finalize.go @@ -586,8 +586,6 @@ func generateEmptyExecutionState( fvm.WithStorageMBPerFLOW(fvm.DefaultStorageMBPerFLOW), fvm.WithEpochConfig(epochConfig), fvm.WithIdentities(identities), - // TODO (JanezP): set this as a default during bootstrapping - fvm.WithSetupEVMEnabled(true), ) if err != nil { log.Fatal().Err(err).Msg("unable to generate execution state") diff --git a/cmd/bootstrap/utils/key_generation.go b/cmd/bootstrap/utils/key_generation.go index eef9532760d..1857bf34eee 100644 --- a/cmd/bootstrap/utils/key_generation.go +++ b/cmd/bootstrap/utils/key_generation.go @@ -13,7 +13,6 @@ import ( sdk "github.com/onflow/flow-go-sdk" sdkcrypto "github.com/onflow/flow-go-sdk/crypto" - "github.com/onflow/flow-go/fvm/systemcontracts" "github.com/onflow/flow-go/model/bootstrap" "github.com/onflow/flow-go/model/encodable" "github.com/onflow/flow-go/model/flow" @@ -174,7 +173,7 @@ func WriteMachineAccountFiles(chainID flow.ChainID, nodeInfos []bootstrap.NodeIn // // for the machine account key, we keep track of the address index to map // the Flow address of the machine account to the key. - addressIndex := uint64(systemcontracts.EVMStorageAccountIndex) + addressIndex := uint64(4) for _, nodeInfo := range nodeInfos { // retrieve private representation of the node @@ -189,7 +188,7 @@ func WriteMachineAccountFiles(chainID flow.ChainID, nodeInfos []bootstrap.NodeIn // Accounts are generated in a known order during bootstrapping, and // account addresses are deterministic based on order for a given chain // configuration. During the bootstrapping we create 4 Flow accounts besides - // the service account (index 1) so node accounts will start at index 6. + // the service account (index 0) so node accounts will start at index 5. // // All nodes have a staking account created for them, only collection and // consensus nodes have a second machine account created.