From 5c8d29ce33d42dbd45611b5614b65186d2d9a170 Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Thu, 21 Nov 2024 09:38:59 -0800 Subject: [PATCH 1/8] pin core-contracts@9c2c0471 latest on feature branch --- go.mod | 4 ++-- go.sum | 8 ++++---- insecure/go.mod | 4 ++-- insecure/go.sum | 8 ++++---- integration/go.mod | 4 ++-- integration/go.sum | 8 ++++---- 6 files changed, 18 insertions(+), 18 deletions(-) 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= From 882163924e5ea7a8b74cea8ed376e733804b311b Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Thu, 21 Nov 2024 09:39:47 -0800 Subject: [PATCH 2/8] reenable TestProtocolVersionUpgrade --- integration/tests/upgrades/protocol_version_upgrade_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/integration/tests/upgrades/protocol_version_upgrade_test.go b/integration/tests/upgrades/protocol_version_upgrade_test.go index 9a2b6da7f7e..636bd51d414 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,9 +24,6 @@ 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)) } From fd270d7cc61521ebe57b8ae87716693e6bb1cbb0 Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Thu, 21 Nov 2024 11:40:54 -0800 Subject: [PATCH 3/8] fixing test configuration --- .../upgrades/protocol_version_upgrade_test.go | 3 +- .../templates/set-protocol-state-version.cdc | 30 ------------------- integration/utils/transactions.go | 6 ++-- 3 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 integration/utils/templates/set-protocol-state-version.cdc diff --git a/integration/tests/upgrades/protocol_version_upgrade_test.go b/integration/tests/upgrades/protocol_version_upgrade_test.go index 636bd51d414..2a23fd55c05 100644 --- a/integration/tests/upgrades/protocol_version_upgrade_test.go +++ b/integration/tests/upgrades/protocol_version_upgrade_test.go @@ -28,6 +28,7 @@ func TestProtocolVersionUpgrade(t *testing.T) { } func (suite *ProtocolVersionUpgradeSuite) SetupTest() { + suite.Suite.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() @@ -37,7 +38,6 @@ func (suite *ProtocolVersionUpgradeSuite) SetupTest() { suite.KVStoreFactory = func(epochStateID flow.Identifier) (protocol_state.KVStoreAPI, error) { return kvstore.NewKVStoreV0(finalizationThreshold, epochExtensionViewCount, epochStateID) } - suite.Suite.SetupTest() } // TestProtocolStateVersionUpgradeServiceEvent tests the process of upgrading the protocol @@ -80,6 +80,7 @@ func (s *ProtocolVersionUpgradeSuite) TestProtocolStateVersionUpgradeServiceEven // after an invalid protocol version upgrade event, we should still have a v0 kvstore snapshot = s.AwaitSnapshotAtView(invalidUpgradeActiveView, time.Minute, 500*time.Millisecond) actualProtocolVersion = snapshot.Encodable().SealingSegment.LatestProtocolStateEntry().KVStore.Version + // below line is failing, probably because we are starting with v0 now... require.Equal(s.T(), INITIAL_PROTOCOL_VERSION, actualProtocolVersion, "should have v0 still after invalid upgrade") // 2. Valid service event should cause a version upgrade diff --git a/integration/utils/templates/set-protocol-state-version.cdc b/integration/utils/templates/set-protocol-state-version.cdc deleted file mode 100644 index 1a6cca1854d..00000000000 --- a/integration/utils/templates/set-protocol-state-version.cdc +++ /dev/null @@ -1,30 +0,0 @@ -import NodeVersionBeacon from 0xNODEVERSIONBEACONADDRESS - -/// Transaction that allows NodeVersionAdmin to specify a new protocol state version. -/// The new version will become active at view `activeView` if the service event -/// is processed and applied to the protocol state within a block `B` such that -/// `B.view + ∆ < activeView`, for a protocol-defined safety threshold ∆. -/// Service events not meeting this threshold are discarded. -/// -/// 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 - - prepare(acct: auth(BorrowValue) &Account) { - // Borrow a reference to the NodeVersionAdmin implementing resource - self.adminRef = acct.storage.borrow<&NodeVersionBeacon.Admin>(from: NodeVersionBeacon.AdminStoragePath) - ?? panic("Couldn't borrow NodeVersionBeacon.Admin Resource") - } - - execute { - let block = getCurrentBlock() - self.adminRef.setPendingProtocolStateVersionUpgrade( - newProtocolVersion: newProtocolVersion, - activeView: block.view + activeViewDiff - ) - } -} diff --git a/integration/utils/transactions.go b/integration/utils/transactions.go index 76d201ea5d8..1b687491b6b 100644 --- a/integration/utils/transactions.go +++ b/integration/utils/transactions.go @@ -24,9 +24,6 @@ var createAndSetupNodeTxScript string //go:embed templates/remove-node.cdc var removeNodeTxScript string -//go:embed templates/set-protocol-state-version.cdc -var setProtocolStateVersionScript string - func LocalnetEnv() templates.Environment { return templates.Environment{ EpochAddress: "f8d6e0586b0a20c7", @@ -195,8 +192,9 @@ func MakeSetProtocolStateVersionTx( activeViewDiff uint64, ) (*sdk.Transaction, error) { accountKey := adminAccount.Keys[adminAccountKeyID] + tx := sdk.NewTransaction(). - SetScript([]byte(templates.ReplaceAddresses(setProtocolStateVersionScript, env))). + SetScript(templates.GenerateSetProtocolStateVersionScript(env)). SetComputeLimit(9999). SetReferenceBlockID(latestBlockID). SetProposalKey(adminAccount.Address, adminAccountKeyID, accountKey.SequenceNumber). From 46e5bb9d07c80bd0b1c318ec10448647ad4cde4f Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Thu, 21 Nov 2024 12:41:53 -0800 Subject: [PATCH 4/8] revert back to custom upgrade script --- .../upgrades/protocol_version_upgrade_test.go | 12 +++----- .../templates/set-protocol-state-version.cdc | 29 +++++++++++++++++++ integration/utils/transactions.go | 5 +++- 3 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 integration/utils/templates/set-protocol-state-version.cdc diff --git a/integration/tests/upgrades/protocol_version_upgrade_test.go b/integration/tests/upgrades/protocol_version_upgrade_test.go index 2a23fd55c05..c42f64702cf 100644 --- a/integration/tests/upgrades/protocol_version_upgrade_test.go +++ b/integration/tests/upgrades/protocol_version_upgrade_test.go @@ -27,17 +27,13 @@ func TestProtocolVersionUpgrade(t *testing.T) { suite.Run(t, new(ProtocolVersionUpgradeSuite)) } -func (suite *ProtocolVersionUpgradeSuite) SetupTest() { - suite.Suite.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(5, 100, epochStateID) } + s.Suite.SetupTest() } // TestProtocolStateVersionUpgradeServiceEvent tests the process of upgrading the protocol diff --git a/integration/utils/templates/set-protocol-state-version.cdc b/integration/utils/templates/set-protocol-state-version.cdc new file mode 100644 index 00000000000..0dd86c4eb61 --- /dev/null +++ b/integration/utils/templates/set-protocol-state-version.cdc @@ -0,0 +1,29 @@ +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 +/// is processed and applied to the protocol state within a block `B` such that +/// `B.view + ∆ < activeView`, for a protocol-defined safety threshold ∆. +/// Service events not meeting this threshold are discarded. +/// +/// 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 + + prepare(acct: auth(BorrowValue) &Account) { + // Borrow a reference to the NodeVersionAdmin implementing resource + self.adminRef = acct.storage.borrow<&NodeVersionBeacon.Admin>(from: NodeVersionBeacon.AdminStoragePath) + ?? panic("Couldn't borrow NodeVersionBeacon.Admin Resource") + } + + execute { + let block = getCurrentBlock() + self.adminRef.emitProtocolStateVersionUpgrade( + newProtocolVersion: newProtocolVersion, + activeView: block.view + activeViewDiff + ) + } +} diff --git a/integration/utils/transactions.go b/integration/utils/transactions.go index 1b687491b6b..6edd8d510ce 100644 --- a/integration/utils/transactions.go +++ b/integration/utils/transactions.go @@ -24,6 +24,9 @@ var createAndSetupNodeTxScript string //go:embed templates/remove-node.cdc var removeNodeTxScript string +//go:embed "templates/set-protocol-state-version.cdc" +var setProtocolStateVersionScript string + func LocalnetEnv() templates.Environment { return templates.Environment{ EpochAddress: "f8d6e0586b0a20c7", @@ -194,7 +197,7 @@ func MakeSetProtocolStateVersionTx( accountKey := adminAccount.Keys[adminAccountKeyID] tx := sdk.NewTransaction(). - SetScript(templates.GenerateSetProtocolStateVersionScript(env)). + SetScript([]byte(templates.ReplaceAddresses(setProtocolStateVersionScript, env))). SetComputeLimit(9999). SetReferenceBlockID(latestBlockID). SetProposalKey(adminAccount.Address, adminAccountKeyID, accountKey.SequenceNumber). From a065619e8c2877123a85ae5b839d8940937d48f1 Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Thu, 21 Nov 2024 13:15:20 -0800 Subject: [PATCH 5/8] require approvals in test to test non-sys chunk service events --- integration/tests/upgrades/suite.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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), } From b36a86e211d075c8ee99a30adca24026167bce9e Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Mon, 25 Nov 2024 09:41:08 -0800 Subject: [PATCH 6/8] update SetEpochExtensionViewCount docs --- state/protocol/protocol_state/kvstore/models.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) } From 5bdb1b31888ef1547be8a2588e399c1e810f6b29 Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Mon, 25 Nov 2024 09:41:31 -0800 Subject: [PATCH 7/8] increase safety threshold, rm old comment --- integration/tests/upgrades/protocol_version_upgrade_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/integration/tests/upgrades/protocol_version_upgrade_test.go b/integration/tests/upgrades/protocol_version_upgrade_test.go index c42f64702cf..3ca3a951b6a 100644 --- a/integration/tests/upgrades/protocol_version_upgrade_test.go +++ b/integration/tests/upgrades/protocol_version_upgrade_test.go @@ -31,7 +31,7 @@ func (s *ProtocolVersionUpgradeSuite) SetupTest() { // Begin the test with a v0 kvstore, rather than the default v1. // This lets us test upgrading v0->v1 s.KVStoreFactory = func(epochStateID flow.Identifier) (protocol_state.KVStoreAPI, error) { - return kvstore.NewKVStoreV0(5, 100, epochStateID) + return kvstore.NewKVStoreV0(10, 50, epochStateID) } s.Suite.SetupTest() } @@ -76,7 +76,6 @@ func (s *ProtocolVersionUpgradeSuite) TestProtocolStateVersionUpgradeServiceEven // after an invalid protocol version upgrade event, we should still have a v0 kvstore snapshot = s.AwaitSnapshotAtView(invalidUpgradeActiveView, time.Minute, 500*time.Millisecond) actualProtocolVersion = snapshot.Encodable().SealingSegment.LatestProtocolStateEntry().KVStore.Version - // below line is failing, probably because we are starting with v0 now... require.Equal(s.T(), INITIAL_PROTOCOL_VERSION, actualProtocolVersion, "should have v0 still after invalid upgrade") // 2. Valid service event should cause a version upgrade From 8120da327a6c58bd2cdf3eb4cd306924e3bd3139 Mon Sep 17 00:00:00 2001 From: Jordan Schalm Date: Wed, 11 Dec 2024 16:45:22 -0800 Subject: [PATCH 8/8] update state commitments --- engine/execution/state/bootstrap/bootstrap_test.go | 2 +- utils/unittest/execution_state.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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/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" }