Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
932c2e9
bump core-contracts version
jordanschalm Feb 28, 2024
1ad4a9f
crash upon seeing upgrade event
jordanschalm Feb 28, 2024
6eb24b8
add test outline
jordanschalm Feb 28, 2024
072b427
cleanup
jordanschalm Feb 28, 2024
8092a02
Merge branch 'feature/protocol-state-kvstore' into jordan/5326-integr…
jordanschalm Mar 13, 2024
285190d
tidy
jordanschalm Mar 13, 2024
ae28282
lint: remove unused type
jordanschalm Mar 13, 2024
da4288d
lint
jordanschalm Mar 14, 2024
89f2d5f
bump core-contracts version
jordanschalm Mar 22, 2024
4176059
Merge branch 'yurii/5556-epochs-hierarchical-state-machine' into jord…
jordanschalm Mar 22, 2024
0b14e61
tidy
jordanschalm Mar 25, 2024
602fc26
proto state changes for integration test
jordanschalm Mar 27, 2024
31760c4
use v0 model in bootstrapping
jordanschalm Mar 27, 2024
7db3147
fix bug - using wrong lookup method
jordanschalm Mar 27, 2024
316f500
add transaction script for proto version upgrade test
jordanschalm Mar 27, 2024
f7035e8
open dbs in read mode in tests
jordanschalm Mar 27, 2024
e89005f
extend blockstate util
jordanschalm Mar 27, 2024
b5f86a4
update upgrade test
jordanschalm Mar 27, 2024
22d8fcc
clarify seq number getter name
jordanschalm Mar 27, 2024
4358faa
Merge branch 'feature/protocol-state-kvstore' into jordan/5326-integr…
jordanschalm Apr 8, 2024
5a781ab
add todos where code needs to be changed
jordanschalm Apr 10, 2024
f673c00
add protocol entries to sealing segment (builder, struct)
jordanschalm Apr 11, 2024
6b4f891
add protostate entries while building segment
jordanschalm Apr 11, 2024
ae6da15
add fixture methods for default pstate id in tests
jordanschalm Apr 11, 2024
d0ac810
sketch changes in state bootstrapping
jordanschalm Apr 11, 2024
b8df8fd
fix first half of sealing segment tests
jordanschalm Apr 11, 2024
03c3792
re-enable all existing sealing segment tests
jordanschalm Apr 11, 2024
0262aed
Merge branch 'yurii/5136-querying-kvstore' into jordan/5120-sealing-s…
jordanschalm Apr 12, 2024
f6bb3f3
Merge branch 'feature/protocol-state-kvstore' into jordan/5120-sealin…
jordanschalm Apr 12, 2024
6afc07e
Merge branch 'yurii/5136-querying-kvstore' into jordan/5120-sealing-s…
jordanschalm Apr 12, 2024
9cffd12
add segment tests
jordanschalm Apr 12, 2024
06a6fee
update docs
jordanschalm Apr 12, 2024
3f06b20
add root protocol state entry to snapshot constructor
jordanschalm Apr 12, 2024
4a21b48
update consensus tests
jordanschalm Apr 12, 2024
d6320a2
store all protocol state entries in bootstrapping
jordanschalm Apr 12, 2024
6656510
refactor: all epoch bootstrapping together
jordanschalm Apr 12, 2024
3088361
Merge branch 'feature/protocol-state-kvstore' into jordan/5120-sealin…
jordanschalm Apr 12, 2024
4e814eb
naming consistency
jordanschalm Apr 12, 2024
c6f238e
re-enable epoch integration tests
jordanschalm Apr 12, 2024
a93aad0
re-enable badger state tests
jordanschalm Apr 12, 2024
a06fb71
lint
jordanschalm Apr 12, 2024
e64bb3f
lint
jordanschalm Apr 12, 2024
6abccfe
correct error in snapshot generation (consensus tests)
jordanschalm Apr 12, 2024
2556f70
remove unused helper method
jordanschalm Apr 12, 2024
2d0cb94
check for changing pstate ID in tests
jordanschalm Apr 12, 2024
2c8c48d
add note about linter config change
jordanschalm Apr 12, 2024
f5e0d3c
consolidate error types in sealing segment
jordanschalm Apr 12, 2024
57b233e
Update state/protocol/protocol_state/kvstore.go
jordanschalm Apr 12, 2024
229b930
lint
jordanschalm Apr 16, 2024
06e9994
Merge branch 'jordan/5120-sealing-segment' of github.com:onflow/flow-…
jordanschalm Apr 16, 2024
96bc90e
use sealing segment for ProtocolState methods on snapshot
jordanschalm Apr 16, 2024
26ac6de
remove protocol state fields from encodable snapshot
jordanschalm Apr 16, 2024
6472f9c
fix test
jordanschalm Apr 16, 2024
c433ec3
lint
jordanschalm Apr 16, 2024
48f9d49
move KeyValueStoreData to flow package
jordanschalm Apr 16, 2024
bd0831a
lint
jordanschalm Apr 16, 2024
94fe946
replace 2 fields with flow.kvdata
jordanschalm Apr 16, 2024
db30d78
remove special handling for snapshots spanning epoch transitions
jordanschalm Apr 17, 2024
c24bf69
fix an edge case with vn epoch join/leave test
jordanschalm Apr 17, 2024
201397b
address review feedback
jordanschalm Apr 18, 2024
bbfba07
Merge branch 'jordan/5120-sealing-segment' into jordan/5326-integration
jordanschalm Apr 18, 2024
6c9843e
use snapshot to check version changes in test
jordanschalm Apr 18, 2024
10a3106
tidy
jordanschalm Apr 18, 2024
0c54bf9
specify v0 kvstore in upgrade test
jordanschalm Apr 18, 2024
50a2c53
remove InvalidEpochTransitionAttempted field from kvstore
jordanschalm Apr 18, 2024
32f7a1a
shorten test
jordanschalm Apr 18, 2024
67bea3a
add documentation
jordanschalm Apr 18, 2024
4e2130e
cleanup/documentation
jordanschalm Apr 18, 2024
1fa0292
Merge branch 'feature/protocol-state-kvstore' into jordan/5326-integr…
jordanschalm Apr 26, 2024
6f7e8dd
lint
jordanschalm Apr 26, 2024
a27f84a
update mocks
jordanschalm Apr 26, 2024
48f74c3
lint
jordanschalm Apr 26, 2024
74a35c5
review feedback
jordanschalm Apr 29, 2024
bade6a9
fix state commitment fixtures
jordanschalm Apr 29, 2024
65bfec8
goimport
jordanschalm Apr 29, 2024
2a0591e
goimport
jordanschalm Apr 29, 2024
5d37f3f
goimports
jordanschalm Apr 29, 2024
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
3 changes: 2 additions & 1 deletion cmd/bootstrap/cmd/finalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/onflow/flow-go/state/protocol"
"github.com/onflow/flow-go/state/protocol/badger"
"github.com/onflow/flow-go/state/protocol/inmem"
"github.com/onflow/flow-go/state/protocol/protocol_state/kvstore"
"github.com/onflow/flow-go/utils/io"
)

Expand Down Expand Up @@ -176,7 +177,7 @@ func finalize(cmd *cobra.Command, args []string) {

// construct serializable root protocol snapshot
log.Info().Msg("constructing root protocol snapshot")
snapshot, err := inmem.SnapshotFromBootstrapStateWithParams(block, result, seal, rootQC, intermediaryData.ProtocolVersion, intermediaryData.EpochCommitSafetyThreshold)
snapshot, err := inmem.SnapshotFromBootstrapStateWithParams(block, result, seal, rootQC, intermediaryData.ProtocolVersion, intermediaryData.EpochCommitSafetyThreshold, kvstore.NewDefaultKVStore)
if err != nil {
log.Fatal().Err(err).Msg("unable to generate root protocol snapshot")
}
Expand Down
2 changes: 1 addition & 1 deletion engine/execution/state/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestBootstrapLedger(t *testing.T) {
}

func TestBootstrapLedger_ZeroTokenSupply(t *testing.T) {
expectedStateCommitmentBytes, _ := hex.DecodeString("394b02bd8207a8f8b86d3af0fe428bc2b11228311b652037175db7823446bcbe")
expectedStateCommitmentBytes, _ := hex.DecodeString("f36a180931261665d9dd9455a0605f156d5b16cede0da642e11c052d58c4fde8")
expectedStateCommitment, err := flow.ToStateCommitment(expectedStateCommitmentBytes)
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion engine/testutil/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ func ExecutionNode(t *testing.T, hub *stub.Hub, identity bootstrap.NodeInfo, ide
diskWal, err := wal.NewDiskWAL(node.Log.With().Str("subcomponent", "wal").Logger(), nil, metricsCollector, dbDir, capacity, pathfinder.PathByteSize, wal.SegmentSize)
require.NoError(t, err)

ls, err := completeLedger.NewLedger(diskWal, capacity, metricsCollector, node.Log.With().Str("compontent", "ledger").Logger(), completeLedger.DefaultPathFinderVersion)
ls, err := completeLedger.NewLedger(diskWal, capacity, metricsCollector, node.Log.With().Str("component", "ledger").Logger(), completeLedger.DefaultPathFinderVersion)
require.NoError(t, err)

compactor, err := completeLedger.NewCompactor(ls, diskWal, zerolog.Nop(), capacity, checkpointDistance, checkpointsToKeep, atomic.NewBool(false), metricsCollector)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ require (
github.com/onflow/cadence v0.42.9
github.com/onflow/crypto v0.25.1
github.com/onflow/flow v0.3.4
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b
github.com/onflow/flow-go-sdk v0.44.0
github.com/onflow/flow/protobuf/go/flow v0.3.7-0.20240404170900-c321c1475f1e
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1363,10 +1363,10 @@ github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A=
github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
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 v0.15.1 h1:xF5wHug6H8vKfz7p1LYy9jck6eD9K1HLjTdi6o4kg1k=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1/go.mod h1:WHp24VkUQfcfZi0XjI1uRVRt5alM5SHVkwOil1U2Tpc=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1 h1:EjWjbyVEA+bMxXbM44dE6MsYeqOu5a9q/EwSWa4ma2M=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1/go.mod h1:c09d6sNyF/j5/pAynK7sNPb1XKqJqk1rxZPEqEL+dUo=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b h1:c22kqZd6SmpdgIhGRqFcbKI+6udc3axakiSHhN4m4iM=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b/go.mod h1:cnCbHh/sxn0c+mk2aUfxb32Sek2SNSbl4MGvA7ALq7U=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b h1:s4ChWTcQmU9P0ZRD5kVhrIMXe4s48+4Ws1/Aqxe8Lh4=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b/go.mod h1:c09d6sNyF/j5/pAynK7sNPb1XKqJqk1rxZPEqEL+dUo=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13 h1:B4ll7e3j+MqTJv2122Enq3RtDNzmIGRu9xjV7fo7un0=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13/go.mod h1:kTMFIySzEJJeupk+7EmXs0EJ6CBWY/MV9fv9iYQk+RU=
github.com/onflow/flow-go-sdk v0.24.0/go.mod h1:IoptMLPyFXWvyd9yYA6/4EmSeeozl6nJoIv4FaEMg74=
Expand Down
4 changes: 2 additions & 2 deletions insecure/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ require (
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.6.0 // indirect
github.com/onflow/cadence v0.42.9 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13 // indirect
github.com/onflow/flow-go-sdk v0.46.0 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions insecure/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1326,10 +1326,10 @@ github.com/onflow/cadence v0.42.9 h1:EX+eak/Jjy9PyKcAEmOViGOHMyP/nCOwJO+deodZlJE
github.com/onflow/cadence v0.42.9/go.mod h1:1wFd+LiNiN6qoZXof3MBdpM6d8BsxbVIxOA77LbIYmE=
github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A=
github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1 h1:xF5wHug6H8vKfz7p1LYy9jck6eD9K1HLjTdi6o4kg1k=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1/go.mod h1:WHp24VkUQfcfZi0XjI1uRVRt5alM5SHVkwOil1U2Tpc=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1 h1:EjWjbyVEA+bMxXbM44dE6MsYeqOu5a9q/EwSWa4ma2M=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1/go.mod h1:c09d6sNyF/j5/pAynK7sNPb1XKqJqk1rxZPEqEL+dUo=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b h1:c22kqZd6SmpdgIhGRqFcbKI+6udc3axakiSHhN4m4iM=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b/go.mod h1:cnCbHh/sxn0c+mk2aUfxb32Sek2SNSbl4MGvA7ALq7U=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b h1:s4ChWTcQmU9P0ZRD5kVhrIMXe4s48+4Ws1/Aqxe8Lh4=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b/go.mod h1:c09d6sNyF/j5/pAynK7sNPb1XKqJqk1rxZPEqEL+dUo=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13 h1:B4ll7e3j+MqTJv2122Enq3RtDNzmIGRu9xjV7fo7un0=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13/go.mod h1:kTMFIySzEJJeupk+7EmXs0EJ6CBWY/MV9fv9iYQk+RU=
github.com/onflow/flow-go-sdk v0.24.0/go.mod h1:IoptMLPyFXWvyd9yYA6/4EmSeeozl6nJoIv4FaEMg74=
Expand Down
4 changes: 2 additions & 2 deletions integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ require (
github.com/libp2p/go-libp2p v0.32.2
github.com/onflow/cadence v0.42.9
github.com/onflow/crypto v0.25.1
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b
github.com/onflow/flow-emulator v0.61.2-0.20240404201132-f53137a8e4cb
github.com/onflow/flow-go v0.33.2-0.20240404171354-0b0592cc5bba
github.com/onflow/flow-go-sdk v0.46.0
Expand Down
8 changes: 4 additions & 4 deletions integration/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1416,10 +1416,10 @@ github.com/onflow/cadence v0.42.9 h1:EX+eak/Jjy9PyKcAEmOViGOHMyP/nCOwJO+deodZlJE
github.com/onflow/cadence v0.42.9/go.mod h1:1wFd+LiNiN6qoZXof3MBdpM6d8BsxbVIxOA77LbIYmE=
github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A=
github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1 h1:xF5wHug6H8vKfz7p1LYy9jck6eD9K1HLjTdi6o4kg1k=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1/go.mod h1:WHp24VkUQfcfZi0XjI1uRVRt5alM5SHVkwOil1U2Tpc=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1 h1:EjWjbyVEA+bMxXbM44dE6MsYeqOu5a9q/EwSWa4ma2M=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1/go.mod h1:c09d6sNyF/j5/pAynK7sNPb1XKqJqk1rxZPEqEL+dUo=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b h1:c22kqZd6SmpdgIhGRqFcbKI+6udc3axakiSHhN4m4iM=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240318135301-f59efe400a8b/go.mod h1:cnCbHh/sxn0c+mk2aUfxb32Sek2SNSbl4MGvA7ALq7U=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b h1:s4ChWTcQmU9P0ZRD5kVhrIMXe4s48+4Ws1/Aqxe8Lh4=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240318135301-f59efe400a8b/go.mod h1:c09d6sNyF/j5/pAynK7sNPb1XKqJqk1rxZPEqEL+dUo=
github.com/onflow/flow-emulator v0.61.2-0.20240404201132-f53137a8e4cb h1:A2R42Vvw+HdAi3DnH2U/AFK4ziOk/wNkVB1lrhEzai8=
github.com/onflow/flow-emulator v0.61.2-0.20240404201132-f53137a8e4cb/go.mod h1:DicO8yliaj+0AFldfwa5No2FfZRQja1R7/abxSHqqDE=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13 h1:B4ll7e3j+MqTJv2122Enq3RtDNzmIGRu9xjV7fo7un0=
Expand Down
6 changes: 3 additions & 3 deletions integration/testnet/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (c *Client) AccountKeyPriv() sdkcrypto.PrivateKey {
return c.accountKeyPriv
}

func (c *Client) GetSeqNumber() uint64 {
func (c *Client) GetAndIncrementSeqNumber() uint64 {
n := c.accountKey.SequenceNumber
c.accountKey.SequenceNumber++
return n
Expand All @@ -122,7 +122,7 @@ func (c *Client) DeployContract(ctx context.Context, refID sdk.Identifier, contr
tx := sdk.NewTransaction().
SetScript([]byte(code.ToCadence())).
SetReferenceBlockID(refID).
SetProposalKey(c.SDKServiceAddress(), 0, c.GetSeqNumber()).
SetProposalKey(c.SDKServiceAddress(), 0, c.GetAndIncrementSeqNumber()).
SetPayer(c.SDKServiceAddress()).
AddAuthorizer(c.SDKServiceAddress())

Expand Down Expand Up @@ -368,7 +368,7 @@ func (c *Client) CreateAccount(
}
tx.SetComputeLimit(1000).
SetReferenceBlockID(latestBlockID).
SetProposalKey(payer, 0, c.GetSeqNumber()).
SetProposalKey(payer, 0, c.GetAndIncrementSeqNumber()).
SetPayer(payer)

err = c.SignAndSendTransaction(ctx, tx)
Expand Down
28 changes: 17 additions & 11 deletions integration/testnet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"testing"
"time"

"github.com/onflow/flow-go/state/protocol/protocol_state"

"github.com/dapperlabs/testingdock"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
Expand Down Expand Up @@ -427,6 +429,7 @@ type NetworkConfig struct {
ViewsInStakingAuction uint64
ViewsInEpoch uint64
EpochCommitSafetyThreshold uint64
KVStoreFactory func(epochStateID flow.Identifier) protocol_state.KVStoreAPI
}

type NetworkConfigOpt func(*NetworkConfig)
Expand All @@ -440,6 +443,7 @@ func NewNetworkConfig(name string, nodes NodeConfigs, opts ...NetworkConfigOpt)
ViewsInDKGPhase: DefaultViewsInDKGPhase,
ViewsInEpoch: DefaultViewsInEpoch,
EpochCommitSafetyThreshold: DefaultEpochCommitSafetyThreshold,
KVStoreFactory: kvstore.NewDefaultKVStore,
}

for _, apply := range opts {
Expand All @@ -450,15 +454,11 @@ func NewNetworkConfig(name string, nodes NodeConfigs, opts ...NetworkConfigOpt)
}

func NewNetworkConfigWithEpochConfig(name string, nodes NodeConfigs, viewsInStakingAuction, viewsInDKGPhase, viewsInEpoch, safetyThreshold uint64, opts ...NetworkConfigOpt) NetworkConfig {
c := NetworkConfig{
Nodes: nodes,
Name: name,
NClusters: 1, // default to 1 cluster
ViewsInStakingAuction: viewsInStakingAuction,
ViewsInDKGPhase: viewsInDKGPhase,
ViewsInEpoch: viewsInEpoch,
EpochCommitSafetyThreshold: safetyThreshold,
}
c := NewNetworkConfig(name, nodes,
WithViewsInStakingAuction(viewsInStakingAuction),
WithViewsInDKGPhase(viewsInDKGPhase),
WithViewsInEpoch(viewsInEpoch),
WithEpochCommitSafetyThreshold(safetyThreshold))

for _, apply := range opts {
apply(&c)
Expand Down Expand Up @@ -491,6 +491,12 @@ func WithEpochCommitSafetyThreshold(threshold uint64) func(*NetworkConfig) {
}
}

func WithKVStoreFactory(factory func(flow.Identifier) protocol_state.KVStoreAPI) func(*NetworkConfig) {
return func(config *NetworkConfig) {
config.KVStoreFactory = factory
}
}

func WithClusters(n uint) func(*NetworkConfig) {
return func(conf *NetworkConfig) {
conf.NClusters = n
Expand Down Expand Up @@ -1158,7 +1164,7 @@ func BootstrapNetwork(networkConf NetworkConfig, bootstrapDir string, chainID fl
Header: rootHeader,
}
root.SetPayload(unittest.PayloadFixture(unittest.WithProtocolStateID(
kvstore.NewDefaultKVStore(
networkConf.KVStoreFactory(
inmem.ProtocolStateFromEpochServiceEvents(epochSetup, epochCommit).ID(),
).ID(),
)))
Expand Down Expand Up @@ -1225,7 +1231,7 @@ func BootstrapNetwork(networkConf NetworkConfig, bootstrapDir string, chainID fl
return nil, fmt.Errorf("has invalid votes: %v", invalidVotesErr)
}

snapshot, err := inmem.SnapshotFromBootstrapStateWithParams(root, result, seal, qc, flow.DefaultProtocolVersion, networkConf.EpochCommitSafetyThreshold)
snapshot, err := inmem.SnapshotFromBootstrapStateWithParams(root, result, seal, qc, flow.DefaultProtocolVersion, networkConf.EpochCommitSafetyThreshold, networkConf.KVStoreFactory)
if err != nil {
return nil, fmt.Errorf("could not create bootstrap state snapshot: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions integration/tests/access/cohort1/access_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (s *AccessAPISuite) TestSendAndSubscribeTransactionStatuses() {
s.Require().NoError(err)
tx.SetComputeLimit(1000).
SetReferenceBlockID(sdk.HexToID(latestBlockID.String())).
SetProposalKey(payer, 0, serviceClient.GetSeqNumber()).
SetProposalKey(payer, 0, serviceClient.GetAndIncrementSeqNumber()).
SetPayer(payer)

tx, err = serviceClient.SignTransaction(tx)
Expand Down Expand Up @@ -441,7 +441,7 @@ func (s *AccessAPISuite) deployContract() *sdk.TransactionResult {
createCounterTx := sdk.NewTransaction().
SetScript([]byte(lib.CreateCounterTx(serviceAddress).ToCadence())).
SetReferenceBlockID(sdk.Identifier(header.ID)).
SetProposalKey(serviceAddress, 0, s.serviceClient.GetSeqNumber()).
SetProposalKey(serviceAddress, 0, s.serviceClient.GetAndIncrementSeqNumber()).
SetPayer(serviceAddress).
AddAuthorizer(serviceAddress).
SetComputeLimit(9999)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (s *ObserverIndexerEnabledSuite) TestObserverIndexedRPCsHappyPath() {
require.NoError(t, err)
createAccountTx.
SetReferenceBlockID(sdk.Identifier(latestBlockID)).
SetProposalKey(serviceAddress, 0, serviceAccountClient.GetSeqNumber()).
SetProposalKey(serviceAddress, 0, serviceAccountClient.GetAndIncrementSeqNumber()).
SetPayer(serviceAddress).
SetComputeLimit(9999)

Expand Down Expand Up @@ -319,7 +319,7 @@ func (s *ObserverIndexerEnabledSuite) TestAllObserverIndexedRPCsHappyPath() {

createAccountTx.
SetReferenceBlockID(sdk.Identifier(latestBlockID)).
SetProposalKey(serviceAddress, 0, serviceAccountClient.GetSeqNumber()).
SetProposalKey(serviceAddress, 0, serviceAccountClient.GetAndIncrementSeqNumber()).
SetPayer(serviceAddress).
SetComputeLimit(9999)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (s *AccessCircuitBreakerSuite) TestCircuitBreaker() {

createAccountTx.
SetReferenceBlockID(sdk.Identifier(latestBlockID)).
SetProposalKey(serviceAddress, 0, accessClient.GetSeqNumber()).
SetProposalKey(serviceAddress, 0, accessClient.GetAndIncrementSeqNumber()).
SetPayer(serviceAddress).
SetComputeLimit(9999)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (s *ExecutionStateSyncSuite) TestHappyPath() {
s.T().Logf("got block height %v ID %v", blockA.Header.Height, blockA.Header.ID())

// wait for the requested number of sealed blocks, then pause the network so we can inspect the dbs
s.BlockState.WaitForSealed(s.T(), blockA.Header.Height+runBlocks)
s.BlockState.WaitForSealedHeight(s.T(), blockA.Header.Height+runBlocks)
s.net.StopContainers()

metrics := metrics.NewNoopCollector()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (w *WintermuteTestSuite) TestWintermuteAttack() {
}

// waits until we seal a height equal to the victim block height
w.BlockState.WaitForSealed(w.T(), victimBlock.Header.Height)
w.BlockState.WaitForSealedHeight(w.T(), victimBlock.Header.Height)
// then checks querying victim block by height returns the original victim block.
blockByHeight, ok := w.BlockState.FinalizedHeight(victimBlock.Header.Height)
require.True(w.T(), ok)
Expand Down
2 changes: 1 addition & 1 deletion integration/tests/common/sealing_and_verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func SealingAndVerificationHappyPathTest(

// waits until blockB is sealed by consensus nodes after result approvals for all of its chunks emitted.
// waits until we seal a height equal to the victim block height
blockState.WaitForSealed(t, blockBHeight)
blockState.WaitForSealedHeight(t, blockBHeight)
// then checks querying victim block by height returns the victim block itself.
blockByHeight, ok := blockState.FinalizedHeight(blockBHeight)
require.True(t, ok)
Expand Down
Loading