diff --git a/engine/execution/state/bootstrap/bootstrap_test.go b/engine/execution/state/bootstrap/bootstrap_test.go index 28301014ab0..9ce8f84912f 100644 --- a/engine/execution/state/bootstrap/bootstrap_test.go +++ b/engine/execution/state/bootstrap/bootstrap_test.go @@ -53,7 +53,7 @@ func TestBootstrapLedger(t *testing.T) { } func TestBootstrapLedger_ZeroTokenSupply(t *testing.T) { - expectedStateCommitmentBytes, _ := hex.DecodeString("d06b0cb5947b99081321263eabff599246a610ae8cfd1b18b1c9373271a7c537") + expectedStateCommitmentBytes, _ := hex.DecodeString("98f14d08f41e7ac9773365f5754e406bf5d54ab166a5a667e80c88f8300a379d") expectedStateCommitment, err := flow.ToStateCommitment(expectedStateCommitmentBytes) require.NoError(t, err) diff --git a/go.mod b/go.mod index b30526e69f3..c140282c2d6 100644 --- a/go.mod +++ b/go.mod @@ -51,8 +51,8 @@ require ( github.com/onflow/cadence v1.0.0-preview.52 github.com/onflow/crypto v0.25.2 github.com/onflow/flow v0.3.4 - github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6 - github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6 + github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d + github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d github.com/onflow/flow-go-sdk v1.0.0-preview.55 github.com/onflow/flow/protobuf/go/flow v0.4.7 github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 diff --git a/go.sum b/go.sum index c07f13e2a81..a0d58f2ef23 100644 --- a/go.sum +++ b/go.sum @@ -921,10 +921,10 @@ github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns= github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY= github.com/onflow/flow v0.3.4 h1:FXUWVdYB90f/rjNcY0Owo30gL790tiYff9Pb/sycXYE= github.com/onflow/flow v0.3.4/go.mod h1:lzyAYmbu1HfkZ9cfnL5/sjrrsnJiUU8fRL26CqLP7+c= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6 h1:G3rQ9gRDxdiW1TUz0RaPPT1R5cSAcd8byhb+UiRn/Xo= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac= -github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6 h1:gDn+waxuTie03H7RdIkesue1LI+1pg/AxqEK2wlnyJE= -github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d h1:+Ky17U+AFQxtru/CRGoW+dUtn4+wETh2Yx2xxq/7odU= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac= +github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d h1:7EAZjUgdL5gc1/mS01vzs4WKUdNl3GzxNOoai0tPdw4= +github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24= github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM= diff --git a/insecure/go.mod b/insecure/go.mod index 640ef526c1d..5012adbd64b 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -204,8 +204,8 @@ require ( github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.8.0-rc.6 // indirect github.com/onflow/cadence v1.0.0-preview.52 // indirect - github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6 // indirect - github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6 // indirect + github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d // indirect + github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d // indirect github.com/onflow/flow-ft/lib/go/contracts v1.0.1 // indirect github.com/onflow/flow-ft/lib/go/templates v1.0.1 // indirect github.com/onflow/flow-go-sdk v1.0.0-preview.55 // indirect diff --git a/insecure/go.sum b/insecure/go.sum index 2f6e91c82e7..be25ae5d057 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -860,10 +860,10 @@ github.com/onflow/cadence v1.0.0-preview.52 h1:hZ92e6lL2+PQa3C1i5jJh0zZYFdW89+X1 github.com/onflow/cadence v1.0.0-preview.52/go.mod h1:7wvvecnAZtYOspLOS3Lh+FuAmMeSrXhAWiycC3kQ1UU= github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns= github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6 h1:G3rQ9gRDxdiW1TUz0RaPPT1R5cSAcd8byhb+UiRn/Xo= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac= -github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6 h1:gDn+waxuTie03H7RdIkesue1LI+1pg/AxqEK2wlnyJE= -github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d h1:+Ky17U+AFQxtru/CRGoW+dUtn4+wETh2Yx2xxq/7odU= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac= +github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d h1:7EAZjUgdL5gc1/mS01vzs4WKUdNl3GzxNOoai0tPdw4= +github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24= github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM= diff --git a/integration/go.mod b/integration/go.mod index 6feabc51c88..46aabca4098 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -22,8 +22,8 @@ require ( github.com/libp2p/go-libp2p v0.32.2 github.com/onflow/cadence v1.0.0-preview.52 github.com/onflow/crypto v0.25.2 - github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6 - github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6 + github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d + github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d github.com/onflow/flow-emulator v1.0.0-preview.41.0.20240829134601-0be55d6970b5 github.com/onflow/flow-go v0.37.7-0.20240826193109-e211841b59f5 github.com/onflow/flow-go-sdk v1.0.0-preview.55 diff --git a/integration/go.sum b/integration/go.sum index 2815bdf02ae..8dd846c252e 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -746,10 +746,10 @@ github.com/onflow/cadence v1.0.0-preview.52 h1:hZ92e6lL2+PQa3C1i5jJh0zZYFdW89+X1 github.com/onflow/cadence v1.0.0-preview.52/go.mod h1:7wvvecnAZtYOspLOS3Lh+FuAmMeSrXhAWiycC3kQ1UU= github.com/onflow/crypto v0.25.2 h1:GjHunqVt+vPcdqhxxhAXiMIF3YiLX7gTuTR5O+VG2ns= github.com/onflow/crypto v0.25.2/go.mod h1:fY7eLqUdMKV8EGOw301unP8h7PvLVy8/6gVR++/g0BY= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6 h1:G3rQ9gRDxdiW1TUz0RaPPT1R5cSAcd8byhb+UiRn/Xo= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.2-0.20241025200435-872ffe7410e6/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac= -github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6 h1:gDn+waxuTie03H7RdIkesue1LI+1pg/AxqEK2wlnyJE= -github.com/onflow/flow-core-contracts/lib/go/templates v1.3.2-0.20241025200435-872ffe7410e6/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d h1:+Ky17U+AFQxtru/CRGoW+dUtn4+wETh2Yx2xxq/7odU= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.4.1-0.20241029155424-807cf69d387d/go.mod h1:9asTBnB6Tw2UlVVtQKyS/egYv3xr4zVlJnJ75z1dfac= +github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d h1:7EAZjUgdL5gc1/mS01vzs4WKUdNl3GzxNOoai0tPdw4= +github.com/onflow/flow-core-contracts/lib/go/templates v1.4.1-0.20241029155424-807cf69d387d/go.mod h1:pN768Al/wLRlf3bwugv9TyxniqJxMu4sxnX9eQJam64= github.com/onflow/flow-emulator v1.0.0-preview.41.0.20240829134601-0be55d6970b5 h1:Z5PC3Sqvl2UemY27uwUwzkLb8EXUf+m/aEimxFzOXuc= github.com/onflow/flow-emulator v1.0.0-preview.41.0.20240829134601-0be55d6970b5/go.mod h1:gFafyGD4Qxs+XT2BRSIjQJ86ILSmgm1VYUoCr1nVxVI= github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24= diff --git a/integration/tests/upgrades/protocol_version_upgrade_test.go b/integration/tests/upgrades/protocol_version_upgrade_test.go index 9a2b6da7f7e..3ca3a951b6a 100644 --- a/integration/tests/upgrades/protocol_version_upgrade_test.go +++ b/integration/tests/upgrades/protocol_version_upgrade_test.go @@ -17,7 +17,6 @@ import ( "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/state/protocol/protocol_state" "github.com/onflow/flow-go/state/protocol/protocol_state/kvstore" - "github.com/onflow/flow-go/utils/unittest" ) type ProtocolVersionUpgradeSuite struct { @@ -25,23 +24,16 @@ type ProtocolVersionUpgradeSuite struct { } func TestProtocolVersionUpgrade(t *testing.T) { - // See https://github.com/onflow/flow-go/pull/5840/files#r1589483631 - // Must merge and pin https://github.com/onflow/flow-core-contracts/pull/419 to re-enable test - unittest.SkipUnless(t, unittest.TEST_TODO, "skipped as it depends on VersionBeacon contract upgrade") suite.Run(t, new(ProtocolVersionUpgradeSuite)) } -func (suite *ProtocolVersionUpgradeSuite) SetupTest() { +func (s *ProtocolVersionUpgradeSuite) SetupTest() { // Begin the test with a v0 kvstore, rather than the default v1. // This lets us test upgrading v0->v1 - protocolState, err := suite.net.BootstrapSnapshot.ProtocolState() - require.NoError(suite.T(), err) - finalizationThreshold := protocolState.GetFinalizationSafetyThreshold() - epochExtensionViewCount := protocolState.GetEpochExtensionViewCount() - suite.KVStoreFactory = func(epochStateID flow.Identifier) (protocol_state.KVStoreAPI, error) { - return kvstore.NewKVStoreV0(finalizationThreshold, epochExtensionViewCount, epochStateID) + s.KVStoreFactory = func(epochStateID flow.Identifier) (protocol_state.KVStoreAPI, error) { + return kvstore.NewKVStoreV0(10, 50, epochStateID) } - suite.Suite.SetupTest() + s.Suite.SetupTest() } // TestProtocolStateVersionUpgradeServiceEvent tests the process of upgrading the protocol diff --git a/integration/tests/upgrades/suite.go b/integration/tests/upgrades/suite.go index 629791d9c86..4391f009f27 100644 --- a/integration/tests/upgrades/suite.go +++ b/integration/tests/upgrades/suite.go @@ -57,8 +57,8 @@ func (s *Suite) SetupTest() { consensusConfigs := []func(config *testnet.NodeConfig){ testnet.WithAdditionalFlag("--cruise-ctl-fallback-proposal-duration=500ms"), - testnet.WithAdditionalFlag("--required-verification-seal-approvals=0"), - testnet.WithAdditionalFlag("--required-construction-seal-approvals=0"), + testnet.WithAdditionalFlag("--required-verification-seal-approvals=1"), + testnet.WithAdditionalFlag("--required-construction-seal-approvals=1"), testnet.WithLogLevel(zerolog.InfoLevel), } diff --git a/integration/utils/templates/set-protocol-state-version.cdc b/integration/utils/templates/set-protocol-state-version.cdc index 1a6cca1854d..0dd86c4eb61 100644 --- a/integration/utils/templates/set-protocol-state-version.cdc +++ b/integration/utils/templates/set-protocol-state-version.cdc @@ -1,4 +1,4 @@ -import NodeVersionBeacon from 0xNODEVERSIONBEACONADDRESS +import NodeVersionBeacon from "NodeVersionBeacon" /// Transaction that allows NodeVersionAdmin to specify a new protocol state version. /// The new version will become active at view `activeView` if the service event @@ -9,7 +9,6 @@ import NodeVersionBeacon from 0xNODEVERSIONBEACONADDRESS /// This is a special version of the admin transaction for use in integration tests. /// We allow the sender to pass in a value to add to the current view, to reduce /// the liklihood that a test spuriously fails due to timing. - transaction(newProtocolVersion: UInt64, activeViewDiff: UInt64) { let adminRef: &NodeVersionBeacon.Admin @@ -22,7 +21,7 @@ transaction(newProtocolVersion: UInt64, activeViewDiff: UInt64) { execute { let block = getCurrentBlock() - self.adminRef.setPendingProtocolStateVersionUpgrade( + self.adminRef.emitProtocolStateVersionUpgrade( newProtocolVersion: newProtocolVersion, activeView: block.view + activeViewDiff ) diff --git a/integration/utils/transactions.go b/integration/utils/transactions.go index 76d201ea5d8..6edd8d510ce 100644 --- a/integration/utils/transactions.go +++ b/integration/utils/transactions.go @@ -24,7 +24,7 @@ var createAndSetupNodeTxScript string //go:embed templates/remove-node.cdc var removeNodeTxScript string -//go:embed templates/set-protocol-state-version.cdc +//go:embed "templates/set-protocol-state-version.cdc" var setProtocolStateVersionScript string func LocalnetEnv() templates.Environment { @@ -195,6 +195,7 @@ func MakeSetProtocolStateVersionTx( activeViewDiff uint64, ) (*sdk.Transaction, error) { accountKey := adminAccount.Keys[adminAccountKeyID] + tx := sdk.NewTransaction(). SetScript([]byte(templates.ReplaceAddresses(setProtocolStateVersionScript, env))). SetComputeLimit(9999). diff --git a/state/protocol/protocol_state/kvstore/models.go b/state/protocol/protocol_state/kvstore/models.go index 53709a20e0c..4f21128c713 100644 --- a/state/protocol/protocol_state/kvstore/models.go +++ b/state/protocol/protocol_state/kvstore/models.go @@ -122,8 +122,8 @@ func (model *Modelv0) SetEpochStateID(id flow.Identifier) { // - kvstore.ErrInvalidValue - if the view count is less than FinalizationSafetyThreshold*2. func (model *Modelv0) SetEpochExtensionViewCount(viewCount uint64) error { // Strictly speaking it should be perfectly fine to use a value viewCount >= model.FinalizationSafetyThreshold. - // By using a sligtly higher value(factor of 2) we ensure that extension is big enough in practice to give operators a bigger - // window in which a valid epoch recover event could be submitted. + // By using a slightly higher value (factor of 2), we ensure that each extension spans a sufficiently big time + // window for the human governance committee to submit a valid epoch recovery transaction. if viewCount < model.FinalizationSafetyThreshold*2 { return fmt.Errorf("invalid view count %d, expect at least %d: %w", viewCount, model.FinalizationSafetyThreshold*2, ErrInvalidValue) } diff --git a/utils/unittest/execution_state.go b/utils/unittest/execution_state.go index 00f816fbbc9..9bf5a51e493 100644 --- a/utils/unittest/execution_state.go +++ b/utils/unittest/execution_state.go @@ -23,7 +23,7 @@ const ServiceAccountPrivateKeySignAlgo = crypto.ECDSAP256 const ServiceAccountPrivateKeyHashAlgo = hash.SHA2_256 // Pre-calculated state commitment with root account with the above private key -const GenesisStateCommitmentHex = "bac7d50115c6a470cdef79e503d8e7c826a5feb8c4e10a5126753ace52653958" +const GenesisStateCommitmentHex = "6a3c5e9ad92edb0588c7e1f1dd75c5b449b44276eaa8e849f54a4a9425131527" var GenesisStateCommitment flow.StateCommitment @@ -87,10 +87,10 @@ func genesisCommitHexByChainID(chainID flow.ChainID) string { return GenesisStateCommitmentHex } if chainID == flow.Testnet { - return "14a64f957d65b09ef6cc9401ad2f8a7a27159fa13524996d5d44eb9f105e29fd" + return "1601994aa167f94141df86e90eea79a1eaa831a61f12f28cd4bf07d968ab6ff0" } if chainID == flow.Sandboxnet { return "e1c08b17f9e5896f03fe28dd37ca396c19b26628161506924fbf785834646ea1" } - return "7584db9154179afd9e9c39d86cb60e1a39677e62f921e1e1661f58b58fed32ec" + return "ded8cdf6371b065da99a00e627dd123ddb2b9e60848047fd4908651426a59618" }