From 1b29583e38ba8021e27b755df987cc6cdb8e657a Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 14:12:52 +0300 Subject: [PATCH 01/23] Updated protobuf version, added compatible range to rpc NodeVersionInfo endpoint --- access/api.go | 2 ++ .../node_builder/access_node_builder.go | 9 ++++---- cmd/observer/node_builder/observer_builder.go | 9 ++++---- engine/access/rpc/backend/backend.go | 22 +++++++++++++++++-- engine/access/rpc/backend/backend_test.go | 2 ++ engine/common/version/version_control.go | 10 +++++++++ go.mod | 3 +++ go.sum | 4 ++-- insecure/go.mod | 3 +++ insecure/go.sum | 4 ++-- integration/go.mod | 3 +++ integration/go.sum | 4 ++-- 12 files changed, 59 insertions(+), 16 deletions(-) diff --git a/access/api.go b/access/api.go index 8ccb91c4bcb..615c196446a 100644 --- a/access/api.go +++ b/access/api.go @@ -272,4 +272,6 @@ type NodeVersionInfo struct { ProtocolVersion uint64 SporkRootBlockHeight uint64 NodeRootBlockHeight uint64 + StartHeight uint64 + EndHeight uint64 } diff --git a/cmd/access/node_builder/access_node_builder.go b/cmd/access/node_builder/access_node_builder.go index b31ea749060..6f381a867fb 100644 --- a/cmd/access/node_builder/access_node_builder.go +++ b/cmd/access/node_builder/access_node_builder.go @@ -323,7 +323,7 @@ type FlowAccessNodeBuilder struct { ExecutionDataPruner *pruner.Pruner ExecutionDatastoreManager edstorage.DatastoreManager ExecutionDataTracker tracker.Storage - versionControl *version.VersionControl + VersionControl *version.VersionControl // The sync engine participants provider is the libp2p peer store for the access node // which is not available until after the network has started. @@ -978,7 +978,7 @@ func (builder *FlowAccessNodeBuilder) BuildExecutionSyncComponents() *FlowAccess builder.programCacheSize > 0, ) - err = builder.ScriptExecutor.Initialize(builder.ExecutionIndexer, scripts, builder.versionControl) + err = builder.ScriptExecutor.Initialize(builder.ExecutionIndexer, scripts, builder.VersionControl) if err != nil { return nil, err } @@ -1813,8 +1813,8 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { // VersionControl needs to consume BlockFinalized events. node.ProtocolEvents.AddConsumer(versionControl) - builder.versionControl = versionControl - versionControlDependable.Init(builder.versionControl) + builder.VersionControl = versionControl + versionControlDependable.Init(builder.VersionControl) return versionControl, nil }). @@ -1921,6 +1921,7 @@ func (builder *FlowAccessNodeBuilder) Build() (cmd.Node, error) { TxResultQueryMode: txResultQueryMode, TxResultsIndex: builder.TxResultsIndex, LastFullBlockHeight: lastFullBlockHeight, + VersionControl: builder.VersionControl, }) if err != nil { return nil, fmt.Errorf("could not initialize backend: %w", err) diff --git a/cmd/observer/node_builder/observer_builder.go b/cmd/observer/node_builder/observer_builder.go index 80c702f2967..6a75ded5de7 100644 --- a/cmd/observer/node_builder/observer_builder.go +++ b/cmd/observer/node_builder/observer_builder.go @@ -279,7 +279,7 @@ type ObserverServiceBuilder struct { ExecutionIndexerCore *indexer.IndexerCore TxResultsIndex *index.TransactionResultsIndex IndexerDependencies *cmd.DependencyList - versionControl *version.VersionControl + VersionControl *version.VersionControl ExecutionDataDownloader execution_data.Downloader ExecutionDataRequester state_synchronization.ExecutionDataRequester @@ -1513,7 +1513,7 @@ func (builder *ObserverServiceBuilder) BuildExecutionSyncComponents() *ObserverS builder.programCacheSize > 0, ) - err = builder.ScriptExecutor.Initialize(builder.ExecutionIndexer, scripts, builder.versionControl) + err = builder.ScriptExecutor.Initialize(builder.ExecutionIndexer, scripts, builder.VersionControl) if err != nil { return nil, err } @@ -1854,8 +1854,8 @@ func (builder *ObserverServiceBuilder) enqueueRPCServer() { // VersionControl needs to consume BlockFinalized events. node.ProtocolEvents.AddConsumer(versionControl) - builder.versionControl = versionControl - versionControlDependable.Init(builder.versionControl) + builder.VersionControl = versionControl + versionControlDependable.Init(builder.VersionControl) return versionControl, nil }) @@ -1930,6 +1930,7 @@ func (builder *ObserverServiceBuilder) enqueueRPCServer() { builder.stateStreamConf.ResponseLimit, builder.stateStreamConf.ClientSendBufferSize, ), + VersionControl: builder.VersionControl, } if builder.localServiceAPIEnabled { diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 3af46045697..a29aa9e7466 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -16,6 +16,7 @@ import ( "github.com/onflow/flow-go/engine/access/rpc/connection" "github.com/onflow/flow-go/engine/access/subscription" "github.com/onflow/flow-go/engine/common/rpc" + "github.com/onflow/flow-go/engine/common/version" "github.com/onflow/flow-go/fvm/blueprints" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/model/flow/filter" @@ -119,6 +120,7 @@ type Params struct { TxResultQueryMode IndexQueryMode TxResultsIndex *index.TransactionResultsIndex LastFullBlockHeight *counters.PersistentStrictMonotonicCounter + VersionControl *version.VersionControl } var _ TransactionErrorMessage = (*Backend)(nil) @@ -163,7 +165,7 @@ func New(params Params) (*Backend, error) { systemTxID := systemTx.ID() // initialize node version info - nodeInfo := getNodeVersionInfo(params.State.Params()) + nodeInfo := getNodeVersionInfo(params.State.Params(), params.VersionControl) transactionsLocalDataProvider := &TransactionsLocalDataProvider{ state: params.State, @@ -349,13 +351,27 @@ func (b *Backend) GetNodeVersionInfo(_ context.Context) (*access.NodeVersionInfo // getNodeVersionInfo returns the NodeVersionInfo for the node. // Since these values are static while the node is running, it is safe to cache. -func getNodeVersionInfo(stateParams protocol.Params) *access.NodeVersionInfo { +func getNodeVersionInfo(stateParams protocol.Params, versionControl *version.VersionControl) *access.NodeVersionInfo { sporkID := stateParams.SporkID() protocolVersion := stateParams.ProtocolVersion() sporkRootBlockHeight := stateParams.SporkRootBlockHeight() nodeRootBlockHeader := stateParams.SealedRoot() + var startHeight uint64 + var endHeight uint64 + + // Version control feature could be disabled + if versionControl != nil { + startHeight = versionControl.StartHeight() + endHeight = versionControl.EndHeight() + } + + // startHeight is the root block if there is no start boundary in the current spork + if startHeight == version.NoHeight { + startHeight = nodeRootBlockHeader.Height + } + nodeInfo := &access.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), @@ -363,6 +379,8 @@ func getNodeVersionInfo(stateParams protocol.Params) *access.NodeVersionInfo { ProtocolVersion: uint64(protocolVersion), SporkRootBlockHeight: sporkRootBlockHeight, NodeRootBlockHeight: nodeRootBlockHeader.Height, + StartHeight: startHeight, + EndHeight: endHeight, } return nodeInfo diff --git a/engine/access/rpc/backend/backend_test.go b/engine/access/rpc/backend/backend_test.go index 63bf2637e3e..8b63661ff8a 100644 --- a/engine/access/rpc/backend/backend_test.go +++ b/engine/access/rpc/backend/backend_test.go @@ -1596,6 +1596,8 @@ func (suite *Suite) TestGetNodeVersionInfo() { ProtocolVersion: uint64(protocolVersion), SporkRootBlockHeight: sporkRootBlock.Height, NodeRootBlockHeight: nodeRootBlock.Height, + StartHeight: nodeRootBlock.Height, + EndHeight: uint64(0), } params := suite.defaultBackendParams() diff --git a/engine/common/version/version_control.go b/engine/common/version/version_control.go index cda72e537b2..a089e8aebd1 100644 --- a/engine/common/version/version_control.go +++ b/engine/common/version/version_control.go @@ -365,3 +365,13 @@ func (v *VersionControl) blockFinalized( } } } + +// StartHeight return the first block that the version supports +func (v *VersionControl) StartHeight() uint64 { + return v.startHeight.Load() +} + +// EndHeight return the last block that the version supports +func (v *VersionControl) EndHeight() uint64 { + return v.endHeight.Load() +} diff --git a/go.mod b/go.mod index 78d250b20c1..df456e0a90e 100644 --- a/go.mod +++ b/go.mod @@ -334,3 +334,6 @@ replace github.com/ipfs/boxo => github.com/onflow/boxo v0.0.0-20240201202436-f24 // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c + +// TODO: remove it when merged +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 diff --git a/go.sum b/go.sum index 1ec823ee51f..fc35826b6ac 100644 --- a/go.sum +++ b/go.sum @@ -989,6 +989,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 h1:PssT4ryYcaUi5RYiG9rosic9TEx16nwK7syaOeQW0VU= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2190,8 +2192,6 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= -github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= diff --git a/insecure/go.mod b/insecure/go.mod index 4ef70de51ea..c0fb115ba3f 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -312,3 +312,6 @@ replace github.com/onflow/flow-go => ../ // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c + +// TODO: remove it when merged +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 diff --git a/insecure/go.sum b/insecure/go.sum index be84a925211..62a6bdea807 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -989,6 +989,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 h1:PssT4ryYcaUi5RYiG9rosic9TEx16nwK7syaOeQW0VU= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2178,8 +2180,6 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= -github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= diff --git a/integration/go.mod b/integration/go.mod index c27de2bd954..1ca97d58754 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -362,3 +362,6 @@ replace github.com/onflow/flow-go/insecure => ../insecure // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c + +// TODO: remove it when merged +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 diff --git a/integration/go.sum b/integration/go.sum index e73a0221eb5..dec1e8bddcb 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,6 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 h1:PssT4ryYcaUi5RYiG9rosic9TEx16nwK7syaOeQW0VU= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2164,8 +2166,6 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flow/protobuf/go/flow v0.4.5 h1:6o+pgYGqwXdEhqSJxu2BdnDXkOQVOkfGAb6IiXB+NPM= -github.com/onflow/flow/protobuf/go/flow v0.4.5/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= From 030fdb9ecbaf545c497d02da72eb693382334eea Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 16:02:22 +0300 Subject: [PATCH 02/23] Updated backend for NodeVersionInfo, updated rpc handler --- access/handler.go | 2 ++ engine/access/rpc/backend/backend.go | 31 +++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/access/handler.go b/access/handler.go index 340fb4e5ef1..2b24e26c195 100644 --- a/access/handler.go +++ b/access/handler.go @@ -100,6 +100,8 @@ func (h *Handler) GetNodeVersionInfo( ProtocolVersion: nodeVersionInfo.ProtocolVersion, SporkRootBlockHeight: nodeVersionInfo.SporkRootBlockHeight, NodeRootBlockHeight: nodeVersionInfo.NodeRootBlockHeight, + StartHeight: nodeVersionInfo.StartHeight, + EndHeight: nodeVersionInfo.EndHeight, }, }, nil } diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index a29aa9e7466..0f1a5897328 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -82,9 +82,9 @@ type Backend struct { executionReceipts storage.ExecutionReceipts connFactory connection.ConnectionFactory - // cache the response to GetNodeVersionInfo since it doesn't change - nodeInfo *access.NodeVersionInfo - BlockTracker subscription.BlockTracker + BlockTracker subscription.BlockTracker + stateParams protocol.Params + versionControl *version.VersionControl } type Params struct { @@ -164,9 +164,6 @@ func New(params Params) (*Backend, error) { } systemTxID := systemTx.ID() - // initialize node version info - nodeInfo := getNodeVersionInfo(params.State.Params(), params.VersionControl) - transactionsLocalDataProvider := &TransactionsLocalDataProvider{ state: params.State, collections: params.Collections, @@ -245,7 +242,8 @@ func New(params Params) (*Backend, error) { executionReceipts: params.ExecutionReceipts, connFactory: params.ConnFactory, chainID: params.ChainID, - nodeInfo: nodeInfo, + stateParams: params.State.Params(), + versionControl: params.VersionControl, } txValidator, err := configureTransactionValidator(params.State, params.ChainID, params.ScriptExecutor, params.CheckPayerBalance) @@ -346,25 +344,24 @@ func (b *Backend) Ping(ctx context.Context) error { // GetNodeVersionInfo returns node version information such as semver, commit, sporkID, protocolVersion, etc func (b *Backend) GetNodeVersionInfo(_ context.Context) (*access.NodeVersionInfo, error) { - return b.nodeInfo, nil + return b.getNodeVersionInfo(), nil } // getNodeVersionInfo returns the NodeVersionInfo for the node. -// Since these values are static while the node is running, it is safe to cache. -func getNodeVersionInfo(stateParams protocol.Params, versionControl *version.VersionControl) *access.NodeVersionInfo { - sporkID := stateParams.SporkID() - protocolVersion := stateParams.ProtocolVersion() - sporkRootBlockHeight := stateParams.SporkRootBlockHeight() +func (b *Backend) getNodeVersionInfo() *access.NodeVersionInfo { + sporkID := b.stateParams.SporkID() + protocolVersion := b.stateParams.ProtocolVersion() + sporkRootBlockHeight := b.stateParams.SporkRootBlockHeight() - nodeRootBlockHeader := stateParams.SealedRoot() + nodeRootBlockHeader := b.stateParams.SealedRoot() var startHeight uint64 var endHeight uint64 // Version control feature could be disabled - if versionControl != nil { - startHeight = versionControl.StartHeight() - endHeight = versionControl.EndHeight() + if b.versionControl != nil { + startHeight = b.versionControl.StartHeight() + endHeight = b.versionControl.EndHeight() } // startHeight is the root block if there is no start boundary in the current spork From b3d90866aed67d96883e12544f2d721061426116 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 16:03:12 +0300 Subject: [PATCH 03/23] Updated REST endpoint --- engine/access/rest/models/model_node_version_info.go | 2 ++ engine/access/rest/models/node_version_info.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/engine/access/rest/models/model_node_version_info.go b/engine/access/rest/models/model_node_version_info.go index 5a53e468996..ce935f33feb 100644 --- a/engine/access/rest/models/model_node_version_info.go +++ b/engine/access/rest/models/model_node_version_info.go @@ -15,4 +15,6 @@ type NodeVersionInfo struct { ProtocolVersion string `json:"protocol_version"` SporkRootBlockHeight string `json:"spork_root_block_height"` NodeRootBlockHeight string `json:"node_root_block_height"` + StartHeight string `json:"start_height"` + EndHeight string `json:"end_height"` } diff --git a/engine/access/rest/models/node_version_info.go b/engine/access/rest/models/node_version_info.go index dc9af010922..f79b703e557 100644 --- a/engine/access/rest/models/node_version_info.go +++ b/engine/access/rest/models/node_version_info.go @@ -12,4 +12,6 @@ func (t *NodeVersionInfo) Build(params *access.NodeVersionInfo) { t.ProtocolVersion = util.FromUint(params.ProtocolVersion) t.SporkRootBlockHeight = util.FromUint(params.SporkRootBlockHeight) t.NodeRootBlockHeight = util.FromUint(params.NodeRootBlockHeight) + t.StartHeight = util.FromUint(params.StartHeight) + t.EndHeight = util.FromUint(params.EndHeight) } From afbdcc0c127ad7cb1101637eccafda5a0522ff5e Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 16:49:36 +0300 Subject: [PATCH 04/23] Updated functional test for REST endpoint --- engine/access/rest/routes/node_version_info_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/access/rest/routes/node_version_info_test.go b/engine/access/rest/routes/node_version_info_test.go index 0bce5c83c13..2b27fae9da5 100644 --- a/engine/access/rest/routes/node_version_info_test.go +++ b/engine/access/rest/routes/node_version_info_test.go @@ -28,13 +28,17 @@ func TestGetNodeVersionInfo(t *testing.T) { t.Run("get node version info", func(t *testing.T) { req := getNodeVersionInfoRequest(t) + nodeRootBlockHeight := unittest.Uint64InRange(10_000, 100_000) + params := &access.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), SporkId: unittest.IdentifierFixture(), ProtocolVersion: unittest.Uint64InRange(10, 30), SporkRootBlockHeight: unittest.Uint64InRange(1000, 10_000), - NodeRootBlockHeight: unittest.Uint64InRange(10_000, 100_000), + NodeRootBlockHeight: nodeRootBlockHeight, + StartHeight: nodeRootBlockHeight, + EndHeight: uint64(0), } backend.Mock. @@ -55,7 +59,9 @@ func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string "spork_id": "%s", "protocol_version": "%d", "spork_root_block_height": "%d", - "node_root_block_height": "%d" + "node_root_block_height": "%d", + "start_height": "%d", + "end_height": "%d" }`, nodeVersionInfo.Semver, nodeVersionInfo.Commit, @@ -63,6 +69,8 @@ func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string nodeVersionInfo.ProtocolVersion, nodeVersionInfo.SporkRootBlockHeight, nodeVersionInfo.NodeRootBlockHeight, + nodeVersionInfo.StartHeight, + nodeVersionInfo.EndHeight, ) } From 05787811c2126f1b2943e6d1fd20b146daea9734 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 20:54:14 +0300 Subject: [PATCH 05/23] Updated test --- engine/access/handle_irrecoverable_state_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/engine/access/handle_irrecoverable_state_test.go b/engine/access/handle_irrecoverable_state_test.go index 74d848a02b1..911ba5c2a53 100644 --- a/engine/access/handle_irrecoverable_state_test.go +++ b/engine/access/handle_irrecoverable_state_test.go @@ -75,12 +75,7 @@ func (suite *IrrecoverableStateTestSuite) SetupTest() { suite.state = protocol.NewState(suite.T()) suite.snapshot = protocol.NewSnapshot(suite.T()) - rootHeader := unittest.BlockHeaderFixture() params := protocol.NewParams(suite.T()) - params.On("SporkID").Return(unittest.IdentifierFixture(), nil) - params.On("ProtocolVersion").Return(uint(unittest.Uint64InRange(10, 30)), nil) - params.On("SporkRootBlockHeight").Return(rootHeader.Height, nil) - params.On("SealedRoot").Return(rootHeader, nil) suite.epochQuery = protocol.NewEpochQuery(suite.T()) suite.state.On("Sealed").Return(suite.snapshot, nil).Maybe() From 7d91f263206411460a70f79383d16e240b72125c Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 21:26:26 +0300 Subject: [PATCH 06/23] Updated backend stream transaction test according to changes --- .../access/rpc/backend/backend_stream_transactions_test.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/engine/access/rpc/backend/backend_stream_transactions_test.go b/engine/access/rpc/backend/backend_stream_transactions_test.go index 78e7b1e676d..ec8ff353bf3 100644 --- a/engine/access/rpc/backend/backend_stream_transactions_test.go +++ b/engine/access/rpc/backend/backend_stream_transactions_test.go @@ -98,13 +98,7 @@ func (s *TransactionStatusSuite) SetupTest() { s.tempSnapshot = &protocol.Snapshot{} s.db, s.dbDir = unittest.TempBadgerDB(s.T()) - header := unittest.BlockHeaderFixture() - params := protocol.NewParams(s.T()) - params.On("SporkID").Return(unittest.IdentifierFixture(), nil) - params.On("ProtocolVersion").Return(uint(unittest.Uint64InRange(10, 30)), nil) - params.On("SporkRootBlockHeight").Return(header.Height, nil) - params.On("SealedRoot").Return(header, nil) s.state.On("Params").Return(params) s.blocks = storagemock.NewBlocks(s.T()) From cfcbe4a7320916de659da44df92269d97bd85afa Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 5 Aug 2024 21:48:08 +0300 Subject: [PATCH 07/23] Added additional test case for NodeVersionInfo endpoint --- engine/access/rpc/backend/backend_test.go | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/engine/access/rpc/backend/backend_test.go b/engine/access/rpc/backend/backend_test.go index 8b63661ff8a..dff83171d77 100644 --- a/engine/access/rpc/backend/backend_test.go +++ b/engine/access/rpc/backend/backend_test.go @@ -5,8 +5,11 @@ import ( "errors" "fmt" "os" + "sort" "testing" + "time" + "github.com/coreos/go-semver/semver" "github.com/dgraph-io/badger/v2" accessproto "github.com/onflow/flow/protobuf/go/flow/access" "github.com/onflow/flow/protobuf/go/flow/entities" @@ -28,6 +31,7 @@ import ( "github.com/onflow/flow-go/engine/access/rpc/connection" connectionmock "github.com/onflow/flow-go/engine/access/rpc/connection/mock" "github.com/onflow/flow-go/engine/common/rpc/convert" + "github.com/onflow/flow-go/engine/common/version" "github.com/onflow/flow-go/fvm/blueprints" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module" @@ -73,6 +77,7 @@ type Suite struct { db *badger.DB dbDir string lastFullBlockHeight *counters.PersistentStrictMonotonicCounter + versionControl *version.VersionControl colClient *access.AccessAPIClient execClient *access.ExecutionAPIClient @@ -1611,6 +1616,102 @@ func (suite *Suite) TestGetNodeVersionInfo() { suite.Require().Equal(expected, actual) }) + + suite.Run("start and end version set", func() { + latestBlockHeight := nodeRootBlock.Height + 100 + versionBeacons := storagemock.NewVersionBeacons(suite.T()) + + events := []*flow.SealedVersionBeacon{ + { + VersionBeacon: unittest.VersionBeaconFixture( + unittest.WithBoundaries(flow.VersionBoundary{BlockHeight: nodeRootBlock.Height + 4, Version: "0.0.1"}), + ), + SealHeight: nodeRootBlock.Height + 2, + }, + { + VersionBeacon: unittest.VersionBeaconFixture( + unittest.WithBoundaries(flow.VersionBoundary{BlockHeight: nodeRootBlock.Height + 12, Version: "0.0.2"}), + ), + SealHeight: nodeRootBlock.Height + 10, + }, + { + VersionBeacon: unittest.VersionBeaconFixture( + unittest.WithBoundaries(flow.VersionBoundary{BlockHeight: latestBlockHeight - 8, Version: "0.0.3"}), + ), + SealHeight: latestBlockHeight - 10, + }, + } + + eventMap := make(map[uint64]*flow.SealedVersionBeacon, len(events)) + for _, event := range events { + eventMap[event.SealHeight] = event + } + + // make sure events are sorted descending by seal height + sort.Slice(events, func(i, j int) bool { + return events[i].SealHeight > events[j].SealHeight + }) + + versionBeacons. + On("Highest", mock.AnythingOfType("uint64")). + Return(func(height uint64) (*flow.SealedVersionBeacon, error) { + // iterating through events sorted descending by seal height + // return the first event that was sealed in a height less than or equal to height + for _, event := range events { + if event.SealHeight <= height { + return event, nil + } + } + return nil, storage.ErrNotFound + }) + + var err error + suite.versionControl, err = version.NewVersionControl( + unittest.Logger(), + versionBeacons, + semver.New("0.0.2"), + nodeRootBlock.Height, + latestBlockHeight, + ) + require.NoError(suite.T(), err) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + // Start the VersionControl component. + suite.versionControl.Start(irrecoverable.NewMockSignalerContext(suite.T(), ctx)) + unittest.RequireComponentsReadyBefore(suite.T(), 2*time.Second, suite.versionControl) + + stateParams := protocol.NewParams(suite.T()) + stateParams.On("SporkID").Return(sporkID, nil) + stateParams.On("ProtocolVersion").Return(protocolVersion, nil) + stateParams.On("SporkRootBlockHeight").Return(sporkRootBlock.Height, nil) + stateParams.On("SealedRoot").Return(nodeRootBlock, nil) + + state := protocol.NewState(suite.T()) + state.On("Params").Return(stateParams, nil).Maybe() + + expected := &accessflow.NodeVersionInfo{ + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlock.Height, + NodeRootBlockHeight: nodeRootBlock.Height, + StartHeight: nodeRootBlock.Height + 12, + EndHeight: latestBlockHeight - 9, + } + + params := suite.defaultBackendParams() + params.State = state + + backend, err := New(params) + suite.Require().NoError(err) + + actual, err := backend.GetNodeVersionInfo(ctx) + suite.Require().NoError(err) + + suite.Require().Equal(expected, actual) + }) } func (suite *Suite) TestGetNetworkParameters() { @@ -2136,5 +2237,6 @@ func (suite *Suite) defaultBackendParams() Params { BlockTracker: nil, TxResultQueryMode: IndexQueryModeExecutionNodesOnly, LastFullBlockHeight: suite.lastFullBlockHeight, + VersionControl: suite.versionControl, } } From 1cb26f9d8ad9c455b7a36293fd677cdb81004610 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Tue, 6 Aug 2024 12:58:23 +0300 Subject: [PATCH 08/23] Updated naming according to comment --- access/api.go | 16 +++++----- access/handler.go | 16 +++++----- .../rest/models/model_node_version_info.go | 16 +++++----- .../access/rest/models/node_version_info.go | 4 +-- .../rest/routes/node_version_info_test.go | 24 +++++++------- engine/access/rpc/backend/backend.go | 30 ++++++++--------- engine/access/rpc/backend/backend_test.go | 32 +++++++++---------- engine/common/version/version_control.go | 8 ++--- go.mod | 2 +- go.sum | 4 +-- insecure/go.mod | 2 +- insecure/go.sum | 4 +-- integration/go.mod | 2 +- integration/go.sum | 4 +-- 14 files changed, 82 insertions(+), 82 deletions(-) diff --git a/access/api.go b/access/api.go index 615c196446a..f05719f6cae 100644 --- a/access/api.go +++ b/access/api.go @@ -266,12 +266,12 @@ type NetworkParameters struct { // NodeVersionInfo contains information about node, such as semver, commit, sporkID, protocolVersion, etc type NodeVersionInfo struct { - Semver string - Commit string - SporkId flow.Identifier - ProtocolVersion uint64 - SporkRootBlockHeight uint64 - NodeRootBlockHeight uint64 - StartHeight uint64 - EndHeight uint64 + Semver string + Commit string + SporkId flow.Identifier + ProtocolVersion uint64 + SporkRootBlockHeight uint64 + NodeRootBlockHeight uint64 + ProtocolVersionStartHeight uint64 + ProtocolVersionEndHeight uint64 } diff --git a/access/handler.go b/access/handler.go index 2b24e26c195..a20636020f2 100644 --- a/access/handler.go +++ b/access/handler.go @@ -94,14 +94,14 @@ func (h *Handler) GetNodeVersionInfo( return &access.GetNodeVersionInfoResponse{ Info: &entities.NodeVersionInfo{ - Semver: nodeVersionInfo.Semver, - Commit: nodeVersionInfo.Commit, - SporkId: nodeVersionInfo.SporkId[:], - ProtocolVersion: nodeVersionInfo.ProtocolVersion, - SporkRootBlockHeight: nodeVersionInfo.SporkRootBlockHeight, - NodeRootBlockHeight: nodeVersionInfo.NodeRootBlockHeight, - StartHeight: nodeVersionInfo.StartHeight, - EndHeight: nodeVersionInfo.EndHeight, + Semver: nodeVersionInfo.Semver, + Commit: nodeVersionInfo.Commit, + SporkId: nodeVersionInfo.SporkId[:], + ProtocolVersion: nodeVersionInfo.ProtocolVersion, + SporkRootBlockHeight: nodeVersionInfo.SporkRootBlockHeight, + NodeRootBlockHeight: nodeVersionInfo.NodeRootBlockHeight, + ProtocolVersionStartHeight: nodeVersionInfo.ProtocolVersionStartHeight, + ProtocolVersionEndHeight: nodeVersionInfo.ProtocolVersionEndHeight, }, }, nil } diff --git a/engine/access/rest/models/model_node_version_info.go b/engine/access/rest/models/model_node_version_info.go index ce935f33feb..2b23307f2af 100644 --- a/engine/access/rest/models/model_node_version_info.go +++ b/engine/access/rest/models/model_node_version_info.go @@ -9,12 +9,12 @@ package models type NodeVersionInfo struct { - Semver string `json:"semver"` - Commit string `json:"commit"` - SporkId string `json:"spork_id"` - ProtocolVersion string `json:"protocol_version"` - SporkRootBlockHeight string `json:"spork_root_block_height"` - NodeRootBlockHeight string `json:"node_root_block_height"` - StartHeight string `json:"start_height"` - EndHeight string `json:"end_height"` + Semver string `json:"semver"` + Commit string `json:"commit"` + SporkId string `json:"spork_id"` + ProtocolVersion string `json:"protocol_version"` + SporkRootBlockHeight string `json:"spork_root_block_height"` + NodeRootBlockHeight string `json:"node_root_block_height"` + ProtocolVersionStartHeight string `json:"protocol_version_start_height"` + ProtocolVersionEndHeight string `json:"protocol_version_end_height"` } diff --git a/engine/access/rest/models/node_version_info.go b/engine/access/rest/models/node_version_info.go index f79b703e557..539a87f1543 100644 --- a/engine/access/rest/models/node_version_info.go +++ b/engine/access/rest/models/node_version_info.go @@ -12,6 +12,6 @@ func (t *NodeVersionInfo) Build(params *access.NodeVersionInfo) { t.ProtocolVersion = util.FromUint(params.ProtocolVersion) t.SporkRootBlockHeight = util.FromUint(params.SporkRootBlockHeight) t.NodeRootBlockHeight = util.FromUint(params.NodeRootBlockHeight) - t.StartHeight = util.FromUint(params.StartHeight) - t.EndHeight = util.FromUint(params.EndHeight) + t.ProtocolVersionStartHeight = util.FromUint(params.ProtocolVersionStartHeight) + t.ProtocolVersionEndHeight = util.FromUint(params.ProtocolVersionEndHeight) } diff --git a/engine/access/rest/routes/node_version_info_test.go b/engine/access/rest/routes/node_version_info_test.go index 2b27fae9da5..c96f600f6c4 100644 --- a/engine/access/rest/routes/node_version_info_test.go +++ b/engine/access/rest/routes/node_version_info_test.go @@ -31,14 +31,14 @@ func TestGetNodeVersionInfo(t *testing.T) { nodeRootBlockHeight := unittest.Uint64InRange(10_000, 100_000) params := &access.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: unittest.IdentifierFixture(), - ProtocolVersion: unittest.Uint64InRange(10, 30), - SporkRootBlockHeight: unittest.Uint64InRange(1000, 10_000), - NodeRootBlockHeight: nodeRootBlockHeight, - StartHeight: nodeRootBlockHeight, - EndHeight: uint64(0), + Semver: build.Version(), + Commit: build.Commit(), + SporkId: unittest.IdentifierFixture(), + ProtocolVersion: unittest.Uint64InRange(10, 30), + SporkRootBlockHeight: unittest.Uint64InRange(1000, 10_000), + NodeRootBlockHeight: nodeRootBlockHeight, + ProtocolVersionStartHeight: nodeRootBlockHeight, + ProtocolVersionEndHeight: uint64(0), } backend.Mock. @@ -60,8 +60,8 @@ func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string "protocol_version": "%d", "spork_root_block_height": "%d", "node_root_block_height": "%d", - "start_height": "%d", - "end_height": "%d" + "protocol_version_start_height": "%d", + "protocol_version_end_height": "%d" }`, nodeVersionInfo.Semver, nodeVersionInfo.Commit, @@ -69,8 +69,8 @@ func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string nodeVersionInfo.ProtocolVersion, nodeVersionInfo.SporkRootBlockHeight, nodeVersionInfo.NodeRootBlockHeight, - nodeVersionInfo.StartHeight, - nodeVersionInfo.EndHeight, + nodeVersionInfo.ProtocolVersionStartHeight, + nodeVersionInfo.ProtocolVersionEndHeight, ) } diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 0f1a5897328..65a4e076f6a 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -355,29 +355,29 @@ func (b *Backend) getNodeVersionInfo() *access.NodeVersionInfo { nodeRootBlockHeader := b.stateParams.SealedRoot() - var startHeight uint64 - var endHeight uint64 + var protocolVersionStartHeight uint64 + var protocolVersionEndHeight uint64 // Version control feature could be disabled if b.versionControl != nil { - startHeight = b.versionControl.StartHeight() - endHeight = b.versionControl.EndHeight() + protocolVersionStartHeight = b.versionControl.ProtocolVersionStartHeight() + protocolVersionEndHeight = b.versionControl.ProtocolVersionEndHeight() } - // startHeight is the root block if there is no start boundary in the current spork - if startHeight == version.NoHeight { - startHeight = nodeRootBlockHeader.Height + // protocolVersionStartHeight is the root block if there is no start boundary in the current spork + if protocolVersionStartHeight == version.NoHeight { + protocolVersionStartHeight = nodeRootBlockHeader.Height } nodeInfo := &access.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkID, - ProtocolVersion: uint64(protocolVersion), - SporkRootBlockHeight: sporkRootBlockHeight, - NodeRootBlockHeight: nodeRootBlockHeader.Height, - StartHeight: startHeight, - EndHeight: endHeight, + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlockHeight, + NodeRootBlockHeight: nodeRootBlockHeader.Height, + ProtocolVersionStartHeight: protocolVersionStartHeight, + ProtocolVersionEndHeight: protocolVersionEndHeight, } return nodeInfo diff --git a/engine/access/rpc/backend/backend_test.go b/engine/access/rpc/backend/backend_test.go index dff83171d77..e9f76ebc26b 100644 --- a/engine/access/rpc/backend/backend_test.go +++ b/engine/access/rpc/backend/backend_test.go @@ -1595,14 +1595,14 @@ func (suite *Suite) TestGetNodeVersionInfo() { state.On("Params").Return(stateParams, nil).Maybe() expected := &accessflow.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkID, - ProtocolVersion: uint64(protocolVersion), - SporkRootBlockHeight: sporkRootBlock.Height, - NodeRootBlockHeight: nodeRootBlock.Height, - StartHeight: nodeRootBlock.Height, - EndHeight: uint64(0), + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlock.Height, + NodeRootBlockHeight: nodeRootBlock.Height, + ProtocolVersionStartHeight: nodeRootBlock.Height, + ProtocolVersionEndHeight: uint64(0), } params := suite.defaultBackendParams() @@ -1691,14 +1691,14 @@ func (suite *Suite) TestGetNodeVersionInfo() { state.On("Params").Return(stateParams, nil).Maybe() expected := &accessflow.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkID, - ProtocolVersion: uint64(protocolVersion), - SporkRootBlockHeight: sporkRootBlock.Height, - NodeRootBlockHeight: nodeRootBlock.Height, - StartHeight: nodeRootBlock.Height + 12, - EndHeight: latestBlockHeight - 9, + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlock.Height, + NodeRootBlockHeight: nodeRootBlock.Height, + ProtocolVersionStartHeight: nodeRootBlock.Height + 12, + ProtocolVersionEndHeight: latestBlockHeight - 9, } params := suite.defaultBackendParams() diff --git a/engine/common/version/version_control.go b/engine/common/version/version_control.go index a089e8aebd1..a1886b1a5d9 100644 --- a/engine/common/version/version_control.go +++ b/engine/common/version/version_control.go @@ -366,12 +366,12 @@ func (v *VersionControl) blockFinalized( } } -// StartHeight return the first block that the version supports -func (v *VersionControl) StartHeight() uint64 { +// ProtocolVersionStartHeight return the first block that the version supports +func (v *VersionControl) ProtocolVersionStartHeight() uint64 { return v.startHeight.Load() } -// EndHeight return the last block that the version supports -func (v *VersionControl) EndHeight() uint64 { +// ProtocolVersionEndHeight return the last block that the version supports +func (v *VersionControl) ProtocolVersionEndHeight() uint64 { return v.endHeight.Load() } diff --git a/go.mod b/go.mod index df456e0a90e..c0a35b6c6f8 100644 --- a/go.mod +++ b/go.mod @@ -336,4 +336,4 @@ replace github.com/ipfs/boxo => github.com/onflow/boxo v0.0.0-20240201202436-f24 replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 diff --git a/go.sum b/go.sum index fc35826b6ac..6dac4d8b0ef 100644 --- a/go.sum +++ b/go.sum @@ -989,8 +989,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 h1:PssT4ryYcaUi5RYiG9rosic9TEx16nwK7syaOeQW0VU= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 h1:XIiA69XoWu+BgbYa1xf38+GUppPaMxWmOgXocOMnBHE= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= diff --git a/insecure/go.mod b/insecure/go.mod index c0fb115ba3f..6f4ef8c6607 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -314,4 +314,4 @@ replace github.com/onflow/flow-go => ../ replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 diff --git a/insecure/go.sum b/insecure/go.sum index 62a6bdea807..b62af70c29a 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -989,8 +989,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 h1:PssT4ryYcaUi5RYiG9rosic9TEx16nwK7syaOeQW0VU= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 h1:XIiA69XoWu+BgbYa1xf38+GUppPaMxWmOgXocOMnBHE= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= diff --git a/integration/go.mod b/integration/go.mod index 1ca97d58754..73e957005d0 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 diff --git a/integration/go.sum b/integration/go.sum index dec1e8bddcb..f215c75a47c 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494 h1:PssT4ryYcaUi5RYiG9rosic9TEx16nwK7syaOeQW0VU= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240805103909-56b1cca23494/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 h1:XIiA69XoWu+BgbYa1xf38+GUppPaMxWmOgXocOMnBHE= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= From f7ac6598625416b48711bedcc238c35779bada9e Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 12 Aug 2024 15:46:04 +0300 Subject: [PATCH 09/23] Updated protobuf and REST versions, moved NodeVersionInfo to model/flow, updated tests --- access/api.go | 14 +------ access/handler.go | 15 ++++---- access/mock/api.go | 10 ++--- .../rest/models/model_compatible_range.go | 15 ++++++++ .../rest/models/model_node_version_info.go | 15 ++++---- .../access/rest/models/node_version_info.go | 13 +++++-- .../rest/routes/node_version_info_test.go | 38 +++++++++++-------- engine/access/rpc/backend/backend.go | 38 +++++++++---------- engine/access/rpc/backend/backend_network.go | 4 +- engine/access/rpc/backend/backend_test.go | 38 +++++++++---------- engine/common/rpc/convert/compatible_range.go | 19 ++++++++++ engine/common/version/version_control.go | 8 ++-- engine/protocol/api.go | 2 +- engine/protocol/mock/api.go | 10 ++--- go.mod | 2 +- go.sum | 4 +- insecure/go.mod | 2 +- insecure/go.sum | 4 +- integration/go.mod | 2 +- integration/go.sum | 4 +- model/flow/node_version_info.go | 20 ++++++++++ 21 files changed, 165 insertions(+), 112 deletions(-) create mode 100644 engine/access/rest/models/model_compatible_range.go create mode 100644 engine/common/rpc/convert/compatible_range.go create mode 100644 model/flow/node_version_info.go diff --git a/access/api.go b/access/api.go index f05719f6cae..cc629c12eab 100644 --- a/access/api.go +++ b/access/api.go @@ -15,7 +15,7 @@ import ( type API interface { Ping(ctx context.Context) error GetNetworkParameters(ctx context.Context) NetworkParameters - GetNodeVersionInfo(ctx context.Context) (*NodeVersionInfo, error) + GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flow.Header, flow.BlockStatus, error) GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flow.Header, flow.BlockStatus, error) @@ -263,15 +263,3 @@ func MessageToTransactionResult(message *access.TransactionResultResponse) *Tran type NetworkParameters struct { ChainID flow.ChainID } - -// NodeVersionInfo contains information about node, such as semver, commit, sporkID, protocolVersion, etc -type NodeVersionInfo struct { - Semver string - Commit string - SporkId flow.Identifier - ProtocolVersion uint64 - SporkRootBlockHeight uint64 - NodeRootBlockHeight uint64 - ProtocolVersionStartHeight uint64 - ProtocolVersionEndHeight uint64 -} diff --git a/access/handler.go b/access/handler.go index a20636020f2..056568395eb 100644 --- a/access/handler.go +++ b/access/handler.go @@ -94,14 +94,13 @@ func (h *Handler) GetNodeVersionInfo( return &access.GetNodeVersionInfoResponse{ Info: &entities.NodeVersionInfo{ - Semver: nodeVersionInfo.Semver, - Commit: nodeVersionInfo.Commit, - SporkId: nodeVersionInfo.SporkId[:], - ProtocolVersion: nodeVersionInfo.ProtocolVersion, - SporkRootBlockHeight: nodeVersionInfo.SporkRootBlockHeight, - NodeRootBlockHeight: nodeVersionInfo.NodeRootBlockHeight, - ProtocolVersionStartHeight: nodeVersionInfo.ProtocolVersionStartHeight, - ProtocolVersionEndHeight: nodeVersionInfo.ProtocolVersionEndHeight, + Semver: nodeVersionInfo.Semver, + Commit: nodeVersionInfo.Commit, + SporkId: nodeVersionInfo.SporkId[:], + ProtocolVersion: nodeVersionInfo.ProtocolVersion, + SporkRootBlockHeight: nodeVersionInfo.SporkRootBlockHeight, + NodeRootBlockHeight: nodeVersionInfo.NodeRootBlockHeight, + CompatibleRange: convert.CompatibleRangeToMessage(nodeVersionInfo.CompatibleRange), }, }, nil } diff --git a/access/mock/api.go b/access/mock/api.go index eaaf6c428f2..18707e00bcd 100644 --- a/access/mock/api.go +++ b/access/mock/api.go @@ -828,23 +828,23 @@ func (_m *API) GetNetworkParameters(ctx context.Context) access.NetworkParameter } // GetNodeVersionInfo provides a mock function with given fields: ctx -func (_m *API) GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error) { +func (_m *API) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetNodeVersionInfo") } - var r0 *access.NodeVersionInfo + var r0 *flow.NodeVersionInfo var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*access.NodeVersionInfo, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (*flow.NodeVersionInfo, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) *access.NodeVersionInfo); ok { + if rf, ok := ret.Get(0).(func(context.Context) *flow.NodeVersionInfo); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*access.NodeVersionInfo) + r0 = ret.Get(0).(*flow.NodeVersionInfo) } } diff --git a/engine/access/rest/models/model_compatible_range.go b/engine/access/rest/models/model_compatible_range.go new file mode 100644 index 00000000000..1937299f7dd --- /dev/null +++ b/engine/access/rest/models/model_compatible_range.go @@ -0,0 +1,15 @@ +/* + * Access API + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 1.0.0 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package models + +// A compatible version range. +type CompatibleRange struct { + StartHeight string `json:"start_height"` + EndHeight string `json:"end_height"` +} diff --git a/engine/access/rest/models/model_node_version_info.go b/engine/access/rest/models/model_node_version_info.go index 2b23307f2af..a6c7a4d915b 100644 --- a/engine/access/rest/models/model_node_version_info.go +++ b/engine/access/rest/models/model_node_version_info.go @@ -9,12 +9,11 @@ package models type NodeVersionInfo struct { - Semver string `json:"semver"` - Commit string `json:"commit"` - SporkId string `json:"spork_id"` - ProtocolVersion string `json:"protocol_version"` - SporkRootBlockHeight string `json:"spork_root_block_height"` - NodeRootBlockHeight string `json:"node_root_block_height"` - ProtocolVersionStartHeight string `json:"protocol_version_start_height"` - ProtocolVersionEndHeight string `json:"protocol_version_end_height"` + Semver string `json:"semver"` + Commit string `json:"commit"` + SporkId string `json:"spork_id"` + ProtocolVersion string `json:"protocol_version"` + SporkRootBlockHeight string `json:"spork_root_block_height"` + NodeRootBlockHeight string `json:"node_root_block_height"` + CompatibleRange *CompatibleRange `json:"compatible_range,omitempty"` } diff --git a/engine/access/rest/models/node_version_info.go b/engine/access/rest/models/node_version_info.go index 539a87f1543..19f5caf2fc4 100644 --- a/engine/access/rest/models/node_version_info.go +++ b/engine/access/rest/models/node_version_info.go @@ -1,17 +1,22 @@ package models import ( - "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/engine/access/rest/util" + "github.com/onflow/flow-go/model/flow" ) -func (t *NodeVersionInfo) Build(params *access.NodeVersionInfo) { +func (t *NodeVersionInfo) Build(params *flow.NodeVersionInfo) { t.Semver = params.Semver t.Commit = params.Commit t.SporkId = params.SporkId.String() t.ProtocolVersion = util.FromUint(params.ProtocolVersion) t.SporkRootBlockHeight = util.FromUint(params.SporkRootBlockHeight) t.NodeRootBlockHeight = util.FromUint(params.NodeRootBlockHeight) - t.ProtocolVersionStartHeight = util.FromUint(params.ProtocolVersionStartHeight) - t.ProtocolVersionEndHeight = util.FromUint(params.ProtocolVersionEndHeight) + + if params.CompatibleRange != nil { + t.CompatibleRange = &CompatibleRange{ + StartHeight: util.FromUint(params.CompatibleRange.StartHeight), + EndHeight: util.FromUint(params.CompatibleRange.EndHeight), + } + } } diff --git a/engine/access/rest/routes/node_version_info_test.go b/engine/access/rest/routes/node_version_info_test.go index c96f600f6c4..5ada93a23ec 100644 --- a/engine/access/rest/routes/node_version_info_test.go +++ b/engine/access/rest/routes/node_version_info_test.go @@ -9,9 +9,9 @@ import ( mocktestify "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/access/mock" "github.com/onflow/flow-go/cmd/build" + "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/utils/unittest" ) @@ -30,15 +30,17 @@ func TestGetNodeVersionInfo(t *testing.T) { nodeRootBlockHeight := unittest.Uint64InRange(10_000, 100_000) - params := &access.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: unittest.IdentifierFixture(), - ProtocolVersion: unittest.Uint64InRange(10, 30), - SporkRootBlockHeight: unittest.Uint64InRange(1000, 10_000), - NodeRootBlockHeight: nodeRootBlockHeight, - ProtocolVersionStartHeight: nodeRootBlockHeight, - ProtocolVersionEndHeight: uint64(0), + params := &flow.NodeVersionInfo{ + Semver: build.Version(), + Commit: build.Commit(), + SporkId: unittest.IdentifierFixture(), + ProtocolVersion: unittest.Uint64InRange(10, 30), + SporkRootBlockHeight: unittest.Uint64InRange(1000, 10_000), + NodeRootBlockHeight: nodeRootBlockHeight, + CompatibleRange: &flow.CompatibleRange{ + StartHeight: nodeRootBlockHeight, + EndHeight: uint64(0), + }, } backend.Mock. @@ -52,7 +54,15 @@ func TestGetNodeVersionInfo(t *testing.T) { }) } -func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string { +func nodeVersionInfoExpectedStr(nodeVersionInfo *flow.NodeVersionInfo) string { + compatibleRange := fmt.Sprintf(`"compatible_range": { + "start_height": "%d", + "end_height": "%d" + }`, + nodeVersionInfo.CompatibleRange.StartHeight, + nodeVersionInfo.CompatibleRange.EndHeight, + ) + return fmt.Sprintf(`{ "semver": "%s", "commit": "%s", @@ -60,8 +70,7 @@ func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string "protocol_version": "%d", "spork_root_block_height": "%d", "node_root_block_height": "%d", - "protocol_version_start_height": "%d", - "protocol_version_end_height": "%d" + %s }`, nodeVersionInfo.Semver, nodeVersionInfo.Commit, @@ -69,8 +78,7 @@ func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string nodeVersionInfo.ProtocolVersion, nodeVersionInfo.SporkRootBlockHeight, nodeVersionInfo.NodeRootBlockHeight, - nodeVersionInfo.ProtocolVersionStartHeight, - nodeVersionInfo.ProtocolVersionEndHeight, + compatibleRange, ) } diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 65a4e076f6a..6988e77b121 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -343,41 +343,41 @@ func (b *Backend) Ping(ctx context.Context) error { } // GetNodeVersionInfo returns node version information such as semver, commit, sporkID, protocolVersion, etc -func (b *Backend) GetNodeVersionInfo(_ context.Context) (*access.NodeVersionInfo, error) { +func (b *Backend) GetNodeVersionInfo(_ context.Context) (*flow.NodeVersionInfo, error) { return b.getNodeVersionInfo(), nil } // getNodeVersionInfo returns the NodeVersionInfo for the node. -func (b *Backend) getNodeVersionInfo() *access.NodeVersionInfo { +func (b *Backend) getNodeVersionInfo() *flow.NodeVersionInfo { sporkID := b.stateParams.SporkID() protocolVersion := b.stateParams.ProtocolVersion() sporkRootBlockHeight := b.stateParams.SporkRootBlockHeight() nodeRootBlockHeader := b.stateParams.SealedRoot() - var protocolVersionStartHeight uint64 - var protocolVersionEndHeight uint64 + var compatibleRange *flow.CompatibleRange // Version control feature could be disabled if b.versionControl != nil { - protocolVersionStartHeight = b.versionControl.ProtocolVersionStartHeight() - protocolVersionEndHeight = b.versionControl.ProtocolVersionEndHeight() - } + compatibleRange = &flow.CompatibleRange{ + StartHeight: b.versionControl.StartHeight(), + EndHeight: b.versionControl.EndHeight(), + } - // protocolVersionStartHeight is the root block if there is no start boundary in the current spork - if protocolVersionStartHeight == version.NoHeight { - protocolVersionStartHeight = nodeRootBlockHeader.Height + // StartHeight is the root block if there is no start boundary in the current spork + if compatibleRange.StartHeight == version.NoHeight { + compatibleRange.StartHeight = nodeRootBlockHeader.Height + } } - nodeInfo := &access.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkID, - ProtocolVersion: uint64(protocolVersion), - SporkRootBlockHeight: sporkRootBlockHeight, - NodeRootBlockHeight: nodeRootBlockHeader.Height, - ProtocolVersionStartHeight: protocolVersionStartHeight, - ProtocolVersionEndHeight: protocolVersionEndHeight, + nodeInfo := &flow.NodeVersionInfo{ + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlockHeight, + NodeRootBlockHeight: nodeRootBlockHeader.Height, + CompatibleRange: compatibleRange, } return nodeInfo diff --git a/engine/access/rpc/backend/backend_network.go b/engine/access/rpc/backend/backend_network.go index 56903ae2a1e..bce370d7d5e 100644 --- a/engine/access/rpc/backend/backend_network.go +++ b/engine/access/rpc/backend/backend_network.go @@ -51,12 +51,12 @@ func (b *backendNetwork) GetNetworkParameters(_ context.Context) access.NetworkP } } -func (b *backendNetwork) GetNodeVersionInfo(_ context.Context) (*access.NodeVersionInfo, error) { +func (b *backendNetwork) GetNodeVersionInfo(_ context.Context) (*flow.NodeVersionInfo, error) { stateParams := b.state.Params() sporkId := stateParams.SporkID() protocolVersion := stateParams.ProtocolVersion() - return &access.NodeVersionInfo{ + return &flow.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), SporkId: sporkId, diff --git a/engine/access/rpc/backend/backend_test.go b/engine/access/rpc/backend/backend_test.go index e9f76ebc26b..caa0f51f46e 100644 --- a/engine/access/rpc/backend/backend_test.go +++ b/engine/access/rpc/backend/backend_test.go @@ -24,7 +24,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - accessflow "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/cmd/build" access "github.com/onflow/flow-go/engine/access/mock" backendmock "github.com/onflow/flow-go/engine/access/rpc/backend/mock" @@ -1594,15 +1593,14 @@ func (suite *Suite) TestGetNodeVersionInfo() { state := protocol.NewState(suite.T()) state.On("Params").Return(stateParams, nil).Maybe() - expected := &accessflow.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkID, - ProtocolVersion: uint64(protocolVersion), - SporkRootBlockHeight: sporkRootBlock.Height, - NodeRootBlockHeight: nodeRootBlock.Height, - ProtocolVersionStartHeight: nodeRootBlock.Height, - ProtocolVersionEndHeight: uint64(0), + expected := &flow.NodeVersionInfo{ + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlock.Height, + NodeRootBlockHeight: nodeRootBlock.Height, + CompatibleRange: nil, } params := suite.defaultBackendParams() @@ -1690,15 +1688,17 @@ func (suite *Suite) TestGetNodeVersionInfo() { state := protocol.NewState(suite.T()) state.On("Params").Return(stateParams, nil).Maybe() - expected := &accessflow.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkID, - ProtocolVersion: uint64(protocolVersion), - SporkRootBlockHeight: sporkRootBlock.Height, - NodeRootBlockHeight: nodeRootBlock.Height, - ProtocolVersionStartHeight: nodeRootBlock.Height + 12, - ProtocolVersionEndHeight: latestBlockHeight - 9, + expected := &flow.NodeVersionInfo{ + Semver: build.Version(), + Commit: build.Commit(), + SporkId: sporkID, + ProtocolVersion: uint64(protocolVersion), + SporkRootBlockHeight: sporkRootBlock.Height, + NodeRootBlockHeight: nodeRootBlock.Height, + CompatibleRange: &flow.CompatibleRange{ + StartHeight: nodeRootBlock.Height + 12, + EndHeight: latestBlockHeight - 9, + }, } params := suite.defaultBackendParams() diff --git a/engine/common/rpc/convert/compatible_range.go b/engine/common/rpc/convert/compatible_range.go new file mode 100644 index 00000000000..ceac4f67a36 --- /dev/null +++ b/engine/common/rpc/convert/compatible_range.go @@ -0,0 +1,19 @@ +package convert + +import ( + "github.com/onflow/flow/protobuf/go/flow/entities" + + "github.com/onflow/flow-go/model/flow" +) + +// CompatibleRangeToMessage converts a flow.CompatibleRange to a protobuf message +func CompatibleRangeToMessage(c *flow.CompatibleRange) *entities.CompatibleRange { + if c != nil { + return &entities.CompatibleRange{ + StartHeight: c.StartHeight, + EndHeight: c.StartHeight, + } + } + + return nil +} diff --git a/engine/common/version/version_control.go b/engine/common/version/version_control.go index a1886b1a5d9..a089e8aebd1 100644 --- a/engine/common/version/version_control.go +++ b/engine/common/version/version_control.go @@ -366,12 +366,12 @@ func (v *VersionControl) blockFinalized( } } -// ProtocolVersionStartHeight return the first block that the version supports -func (v *VersionControl) ProtocolVersionStartHeight() uint64 { +// StartHeight return the first block that the version supports +func (v *VersionControl) StartHeight() uint64 { return v.startHeight.Load() } -// ProtocolVersionEndHeight return the last block that the version supports -func (v *VersionControl) ProtocolVersionEndHeight() uint64 { +// EndHeight return the last block that the version supports +func (v *VersionControl) EndHeight() uint64 { return v.endHeight.Load() } diff --git a/engine/protocol/api.go b/engine/protocol/api.go index 9d3fdb7a853..95d7124b4da 100644 --- a/engine/protocol/api.go +++ b/engine/protocol/api.go @@ -15,7 +15,7 @@ type NetworkAPI interface { GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error) GetProtocolStateSnapshotByBlockID(ctx context.Context, blockID flow.Identifier) ([]byte, error) GetProtocolStateSnapshotByHeight(ctx context.Context, blockHeight uint64) ([]byte, error) - GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error) + GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) } type API interface { diff --git a/engine/protocol/mock/api.go b/engine/protocol/mock/api.go index f2e4fb175fa..c622ca35bc4 100644 --- a/engine/protocol/mock/api.go +++ b/engine/protocol/mock/api.go @@ -246,23 +246,23 @@ func (_m *API) GetNetworkParameters(ctx context.Context) access.NetworkParameter } // GetNodeVersionInfo provides a mock function with given fields: ctx -func (_m *API) GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error) { +func (_m *API) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetNodeVersionInfo") } - var r0 *access.NodeVersionInfo + var r0 *flow.NodeVersionInfo var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*access.NodeVersionInfo, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (*flow.NodeVersionInfo, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) *access.NodeVersionInfo); ok { + if rf, ok := ret.Get(0).(func(context.Context) *flow.NodeVersionInfo); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*access.NodeVersionInfo) + r0 = ret.Get(0).(*flow.NodeVersionInfo) } } diff --git a/go.mod b/go.mod index c3dca597f2f..769c08aa27a 100644 --- a/go.mod +++ b/go.mod @@ -336,4 +336,4 @@ replace github.com/ipfs/boxo => github.com/onflow/boxo v0.0.0-20240201202436-f24 replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff diff --git a/go.sum b/go.sum index 6dac4d8b0ef..f311c5b4ccd 100644 --- a/go.sum +++ b/go.sum @@ -989,8 +989,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 h1:XIiA69XoWu+BgbYa1xf38+GUppPaMxWmOgXocOMnBHE= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= diff --git a/insecure/go.mod b/insecure/go.mod index 6f4ef8c6607..1d73bec9c21 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -314,4 +314,4 @@ replace github.com/onflow/flow-go => ../ replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff diff --git a/insecure/go.sum b/insecure/go.sum index b62af70c29a..208cdc3fcf9 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -989,8 +989,8 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 h1:XIiA69XoWu+BgbYa1xf38+GUppPaMxWmOgXocOMnBHE= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= diff --git a/integration/go.mod b/integration/go.mod index 73e957005d0..60a1edf39b4 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 +replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff diff --git a/integration/go.sum b/integration/go.sum index f215c75a47c..d012cb5ecc4 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989 h1:XIiA69XoWu+BgbYa1xf38+GUppPaMxWmOgXocOMnBHE= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240806093537-6ed311fd7989/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= +github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= diff --git a/model/flow/node_version_info.go b/model/flow/node_version_info.go new file mode 100644 index 00000000000..a10296283cb --- /dev/null +++ b/model/flow/node_version_info.go @@ -0,0 +1,20 @@ +package flow + +// CompatibleRange contains the first and the last height that the version supports. +type CompatibleRange struct { + // The first block that the version supports. + StartHeight uint64 + // The last block that the version supports. + EndHeight uint64 +} + +// NodeVersionInfo contains information about node, such as semver, commit, sporkID, protocolVersion, etc +type NodeVersionInfo struct { + Semver string + Commit string + SporkId Identifier + ProtocolVersion uint64 + SporkRootBlockHeight uint64 + NodeRootBlockHeight uint64 + CompatibleRange *CompatibleRange +} From b8471a61ec9857b2b73f1aca14c8bfe953770852 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 12 Aug 2024 16:31:34 +0300 Subject: [PATCH 10/23] Added lint to integration makefile --- integration/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/integration/Makefile b/integration/Makefile index df840bebc8b..4893e0cc9ff 100644 --- a/integration/Makefile +++ b/integration/Makefile @@ -97,3 +97,10 @@ bft-gossipsub-tests: .PHONY: bft-tests bft-tests: bft-framework-tests bft-protocol-tests bft-gossipsub-tests +.PHONY: lint +lint: + golangci-lint run -v ./... + +.PHONY: fix-lint +fix-lint: + golangci-lint run -v --fix ./... From 3df9a49d452d06ebdedf45b80fd8c8cc590595f2 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 12 Aug 2024 17:33:12 +0300 Subject: [PATCH 11/23] Updated flow-emulator version --- integration/go.mod | 5 ++++- integration/go.sum | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 87f7166c20d..be7a0caf8ef 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -25,7 +25,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f - github.com/onflow/flow-go v0.36.8-0.20240729193633-433a32eeb0cd + github.com/onflow/flow-go v0.37.0-crescendo-RC3.0.20240808013212-1dd0921e5306 github.com/onflow/flow-go-sdk v1.0.0-preview.47 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 github.com/onflow/flow/protobuf/go/flow v0.4.5 @@ -365,3 +365,6 @@ replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0 // TODO: remove it when merged replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff + +// TODO: remove it when merged +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6 diff --git a/integration/go.sum b/integration/go.sum index 5b8e70a3d65..53ae7bf25f3 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,6 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6 h1:YzH4OjCtUMaxKlDyO3GQn2t8uJ4kSnInMGDm5h30Q8M= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6/go.mod h1:Qj+2esS/jxypx9iRiHnUq+L2HHefi/lnaP872j+d0RQ= github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= @@ -2152,8 +2154,6 @@ github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 h1:q9tXLIALwQ76bO4 github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 h1:FfhMBAb78p6VAWkJ+iqdKLErGQVQgxk5w6DP5ZruWX8= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30= -github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f h1:2Ejpmm2Vrl/XLaE6lniE1vNfi6WYhzqHiCk6oomGoFE= -github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f/go.mod h1:0rqp896zEcjNqqDiQNBUlpS/7nzS4+E+yG/4s0P13bQ= github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0= github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs= From 61556552b3ca3a103a1a2a83d1c00fd4f89f2968 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Fri, 16 Aug 2024 13:11:13 +0300 Subject: [PATCH 12/23] Updated protobuf version --- go.mod | 5 +---- go.sum | 4 ++-- insecure/go.mod | 5 +---- insecure/go.sum | 4 ++-- integration/go.mod | 5 +---- integration/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index e706580f7da..528d7f93d08 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-go-sdk v1.0.0-preview.50 - github.com/onflow/flow/protobuf/go/flow v0.4.5 + github.com/onflow/flow/protobuf/go/flow v0.4.6 github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 github.com/pierrec/lz4 v2.6.1+incompatible github.com/pkg/errors v0.9.1 @@ -334,6 +334,3 @@ replace github.com/ipfs/boxo => github.com/onflow/boxo v0.0.0-20240201202436-f24 // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c - -// TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff diff --git a/go.sum b/go.sum index 5a904a18fc5..02860c5b122 100644 --- a/go.sum +++ b/go.sum @@ -989,8 +989,6 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2193,6 +2191,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.6 h1:KE/CsRVfyG5lGBtm1aNcjojMciQyS5GfPF3ixOWRfi0= +github.com/onflow/flow/protobuf/go/flow v0.4.6/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= diff --git a/insecure/go.mod b/insecure/go.mod index ff82591f6fc..48f5406eaa2 100644 --- a/insecure/go.mod +++ b/insecure/go.mod @@ -210,7 +210,7 @@ require ( github.com/onflow/flow-go-sdk v1.0.0-preview.50 // indirect github.com/onflow/flow-nft/lib/go/contracts v1.2.1 // indirect github.com/onflow/flow-nft/lib/go/templates v1.2.0 // indirect - github.com/onflow/flow/protobuf/go/flow v0.4.5 // indirect + github.com/onflow/flow/protobuf/go/flow v0.4.6 // indirect github.com/onflow/go-ethereum v1.14.7 // indirect github.com/onflow/sdks v0.6.0-preview.1 // indirect github.com/onflow/wal v1.0.2 // indirect @@ -312,6 +312,3 @@ replace github.com/onflow/flow-go => ../ // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c - -// TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff diff --git a/insecure/go.sum b/insecure/go.sum index ac4a280e2ff..f233749ccab 100644 --- a/insecure/go.sum +++ b/insecure/go.sum @@ -989,8 +989,6 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMx github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2181,6 +2179,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.6 h1:KE/CsRVfyG5lGBtm1aNcjojMciQyS5GfPF3ixOWRfi0= +github.com/onflow/flow/protobuf/go/flow v0.4.6/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= diff --git a/integration/go.mod b/integration/go.mod index dbdf147e3ff..97dbabdd4a1 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -28,7 +28,7 @@ require ( github.com/onflow/flow-go v0.37.0-crescendo-RC3.0.20240808013212-1dd0921e5306 github.com/onflow/flow-go-sdk v1.0.0-preview.50 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 - github.com/onflow/flow/protobuf/go/flow v0.4.5 + github.com/onflow/flow/protobuf/go/flow v0.4.6 github.com/onflow/go-ethereum v1.14.7 github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 @@ -363,8 +363,5 @@ replace github.com/onflow/flow-go/insecure => ../insecure // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c -// TODO: remove it when merged -replace github.com/onflow/flow/protobuf/go/flow v0.4.5 => github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff - // TODO: remove it when merged replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6 diff --git a/integration/go.sum b/integration/go.sum index e1e78941eea..6d50e8547d9 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -1001,8 +1001,6 @@ github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDO github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6 h1:YzH4OjCtUMaxKlDyO3GQn2t8uJ4kSnInMGDm5h30Q8M= github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6/go.mod h1:Qj+2esS/jxypx9iRiHnUq+L2HHefi/lnaP872j+d0RQ= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff h1:iTfP+mBjFB1lH6660xg0Z7dDDd9w0cT/m2PVugbgB20= -github.com/The-K-R-O-K/flow/protobuf/go/flow v0.0.0-20240812105951-72fdc9e2dcff/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2167,6 +2165,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkp github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc= github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0= github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow/protobuf/go/flow v0.4.6 h1:KE/CsRVfyG5lGBtm1aNcjojMciQyS5GfPF3ixOWRfi0= +github.com/onflow/flow/protobuf/go/flow v0.4.6/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c h1:T0jDCm7k7uqDo26JiiujQ5oryl30itPnlmZQywTu9ng= github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c/go.mod h1:XYnWtulwJvHVOr2B0WVA/UC3dvRgFevjp8Pn9a3E1xo= github.com/onflow/go-ethereum v1.14.7 h1:gg3awYqI02e3AypRdpJKEvNTJ6kz/OhAqRti0h54Wlc= From 22e8b04310a846c9b3d58e0fdedefcab638806d6 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Fri, 16 Aug 2024 13:18:18 +0300 Subject: [PATCH 13/23] Fixed convertion from CompatibleRange to protobuf message --- engine/common/rpc/convert/compatible_range.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/common/rpc/convert/compatible_range.go b/engine/common/rpc/convert/compatible_range.go index ceac4f67a36..f3063b7aa9a 100644 --- a/engine/common/rpc/convert/compatible_range.go +++ b/engine/common/rpc/convert/compatible_range.go @@ -11,7 +11,7 @@ func CompatibleRangeToMessage(c *flow.CompatibleRange) *entities.CompatibleRange if c != nil { return &entities.CompatibleRange{ StartHeight: c.StartHeight, - EndHeight: c.StartHeight, + EndHeight: c.EndHeight, } } From cc044be690305c620ebca67c729803a094bfd644 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Fri, 16 Aug 2024 13:45:35 +0300 Subject: [PATCH 14/23] Updated flow-emulator version --- integration/go.mod | 4 ++-- integration/go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 97dbabdd4a1..3aa9c23fea5 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -25,7 +25,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f - github.com/onflow/flow-go v0.37.0-crescendo-RC3.0.20240808013212-1dd0921e5306 + github.com/onflow/flow-go v0.37.1 github.com/onflow/flow-go-sdk v1.0.0-preview.50 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 github.com/onflow/flow/protobuf/go/flow v0.4.6 @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6 +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240816104201-ccd7c1451926 diff --git a/integration/go.sum b/integration/go.sum index 6d50e8547d9..289ce57aaab 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6 h1:YzH4OjCtUMaxKlDyO3GQn2t8uJ4kSnInMGDm5h30Q8M= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240812141422-9597eccc6cd6/go.mod h1:Qj+2esS/jxypx9iRiHnUq+L2HHefi/lnaP872j+d0RQ= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240816104201-ccd7c1451926 h1:TQp6qKpBHMZxUlGn3wPjNoHhnoRMjh/qxCQ6Mz9Kn+g= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240816104201-ccd7c1451926/go.mod h1:P/mNTUBwgUuInatn0RRVR6JkA834Yn0X4QLBb7LlaCY= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= From 88f3ffe6d077c63d3a53d9a9ff2a748b74b73953 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 19 Aug 2024 13:20:08 +0300 Subject: [PATCH 15/23] Updated start height getter logic --- engine/access/rpc/backend/backend.go | 5 ----- engine/common/version/version_control.go | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 6988e77b121..793b0a47a8f 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -363,11 +363,6 @@ func (b *Backend) getNodeVersionInfo() *flow.NodeVersionInfo { StartHeight: b.versionControl.StartHeight(), EndHeight: b.versionControl.EndHeight(), } - - // StartHeight is the root block if there is no start boundary in the current spork - if compatibleRange.StartHeight == version.NoHeight { - compatibleRange.StartHeight = nodeRootBlockHeader.Height - } } nodeInfo := &flow.NodeVersionInfo{ diff --git a/engine/common/version/version_control.go b/engine/common/version/version_control.go index aa9f68ae5e3..be7c2be07f5 100644 --- a/engine/common/version/version_control.go +++ b/engine/common/version/version_control.go @@ -362,7 +362,13 @@ func (v *VersionControl) blockFinalized( // StartHeight return the first block that the version supports func (v *VersionControl) StartHeight() uint64 { - return v.startHeight.Load() + var startHeight = v.startHeight.Load() + // start height is the sealed root block if there is no start boundary in the current spork + if startHeight == NoHeight { + startHeight = v.sealedRootBlockHeight.Load() + } + + return startHeight } // EndHeight return the last block that the version supports From 532189ea10e0bb775d2663e6e94e17c6bd2f6ce6 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 19 Aug 2024 13:27:35 +0300 Subject: [PATCH 16/23] Merged 2 methods --- engine/access/rpc/backend/backend.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 793b0a47a8f..3df2c087445 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -344,11 +344,6 @@ func (b *Backend) Ping(ctx context.Context) error { // GetNodeVersionInfo returns node version information such as semver, commit, sporkID, protocolVersion, etc func (b *Backend) GetNodeVersionInfo(_ context.Context) (*flow.NodeVersionInfo, error) { - return b.getNodeVersionInfo(), nil -} - -// getNodeVersionInfo returns the NodeVersionInfo for the node. -func (b *Backend) getNodeVersionInfo() *flow.NodeVersionInfo { sporkID := b.stateParams.SporkID() protocolVersion := b.stateParams.ProtocolVersion() sporkRootBlockHeight := b.stateParams.SporkRootBlockHeight() @@ -375,7 +370,7 @@ func (b *Backend) getNodeVersionInfo() *flow.NodeVersionInfo { CompatibleRange: compatibleRange, } - return nodeInfo + return nodeInfo, nil } func (b *Backend) GetCollectionByID(_ context.Context, colID flow.Identifier) (*flow.LightCollection, error) { From 5c65f14ab57d83075ed5705b0781f0527bc42474 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 19 Aug 2024 13:39:36 +0300 Subject: [PATCH 17/23] Updated EndHeight according to comment --- engine/common/version/version_control.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/engine/common/version/version_control.go b/engine/common/version/version_control.go index be7c2be07f5..5bd45901114 100644 --- a/engine/common/version/version_control.go +++ b/engine/common/version/version_control.go @@ -360,10 +360,12 @@ func (v *VersionControl) blockFinalized( } } -// StartHeight return the first block that the version supports +// StartHeight return the first block that the version supports. +// Start height is the sealed root block if there is no start boundary in the current spork. func (v *VersionControl) StartHeight() uint64 { - var startHeight = v.startHeight.Load() - // start height is the sealed root block if there is no start boundary in the current spork + startHeight := v.startHeight.Load() + + // in case no start boundary in the current spork if startHeight == NoHeight { startHeight = v.sealedRootBlockHeight.Load() } @@ -371,7 +373,15 @@ func (v *VersionControl) StartHeight() uint64 { return startHeight } -// EndHeight return the last block that the version supports +// EndHeight return the last block that the version supports. +// End height is the last processed height if there is no end boundary in the current spork. func (v *VersionControl) EndHeight() uint64 { - return v.endHeight.Load() + endHeight := v.endHeight.Load() + + // in case no end boundary in the current spork + if endHeight == NoHeight { + endHeight = v.lastProcessedHeight.Load() + } + + return endHeight } From f0e08af6d1c0b9443b19a50a66845d7d7b4069dd Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 19 Aug 2024 14:27:41 +0300 Subject: [PATCH 18/23] Removed duplicate implementation --- engine/access/rpc/backend/backend_network.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/engine/access/rpc/backend/backend_network.go b/engine/access/rpc/backend/backend_network.go index bce370d7d5e..97d914d9323 100644 --- a/engine/access/rpc/backend/backend_network.go +++ b/engine/access/rpc/backend/backend_network.go @@ -10,7 +10,6 @@ import ( "google.golang.org/grpc/status" "github.com/onflow/flow-go/access" - "github.com/onflow/flow-go/cmd/build" "github.com/onflow/flow-go/engine/common/rpc/convert" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/state/protocol" @@ -51,19 +50,6 @@ func (b *backendNetwork) GetNetworkParameters(_ context.Context) access.NetworkP } } -func (b *backendNetwork) GetNodeVersionInfo(_ context.Context) (*flow.NodeVersionInfo, error) { - stateParams := b.state.Params() - sporkId := stateParams.SporkID() - protocolVersion := stateParams.ProtocolVersion() - - return &flow.NodeVersionInfo{ - Semver: build.Version(), - Commit: build.Commit(), - SporkId: sporkId, - ProtocolVersion: uint64(protocolVersion), - }, nil -} - // GetLatestProtocolStateSnapshot returns the latest finalized snapshot. func (b *backendNetwork) GetLatestProtocolStateSnapshot(_ context.Context) ([]byte, error) { snapshot := b.state.Final() From 84ec98e6c76bf26012f89e3d15ccaf2868401477 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 19 Aug 2024 15:11:42 +0300 Subject: [PATCH 19/23] Added test for CompatibleRangeToMessage --- .../rpc/convert/compatible_range_test.go | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 engine/common/rpc/convert/compatible_range_test.go diff --git a/engine/common/rpc/convert/compatible_range_test.go b/engine/common/rpc/convert/compatible_range_test.go new file mode 100644 index 00000000000..2fb9467fca2 --- /dev/null +++ b/engine/common/rpc/convert/compatible_range_test.go @@ -0,0 +1,32 @@ +package convert_test + +import ( + "math/rand" + "testing" + + "github.com/onflow/flow/protobuf/go/flow/entities" + "github.com/stretchr/testify/assert" + + "github.com/onflow/flow-go/engine/common/rpc/convert" + "github.com/onflow/flow-go/model/flow" +) + +// TestConvertCompatibleRange tests that converting a compatible range to a protobuf message +func TestConvertCompatibleRange(t *testing.T) { + t.Parallel() + + startHeight := uint64(rand.Uint32()) + endHeight := uint64(rand.Uint32()) + + comparableRange := &flow.CompatibleRange{ + StartHeight: startHeight, + EndHeight: endHeight, + } + expected := &entities.CompatibleRange{ + StartHeight: startHeight, + EndHeight: endHeight, + } + + msg := convert.CompatibleRangeToMessage(comparableRange) + assert.Equal(t, msg, expected) +} From 834529eda4e6e4dd9b19b619ce4fa9f7d7aae625 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Mon, 26 Aug 2024 13:47:13 +0300 Subject: [PATCH 20/23] Updated flow-emulator version --- integration/go.mod | 2 +- integration/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 3f8ce87e076..b068d951e4c 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240816104201-ccd7c1451926 +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240826100127-716edf8c9715 diff --git a/integration/go.sum b/integration/go.sum index 62d073f9a90..c1309f4752d 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240816104201-ccd7c1451926 h1:TQp6qKpBHMZxUlGn3wPjNoHhnoRMjh/qxCQ6Mz9Kn+g= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240816104201-ccd7c1451926/go.mod h1:P/mNTUBwgUuInatn0RRVR6JkA834Yn0X4QLBb7LlaCY= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240826100127-716edf8c9715 h1:Hbil1d2AAYLyDe+PPPoSMwMza9i2VwmXmOUFrpbYkTU= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240826100127-716edf8c9715/go.mod h1:4kpN3sLpvPQlHpl+6dLCrb7+e2qGEFsbZc6slI5Yc9Y= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= From 50dcd73fdd3f6530d354f84bebe71d2348ed0717 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Tue, 27 Aug 2024 14:12:48 +0300 Subject: [PATCH 21/23] Moved NodeVersionInfo to access module --- access/api.go | 33 ++++++++++++++++++- access/handler.go | 2 +- access/mock/api.go | 10 +++--- .../access/rest/models/node_version_info.go | 4 +-- .../rest/routes/node_version_info_test.go | 8 ++--- engine/access/rpc/backend/backend.go | 8 ++--- engine/access/rpc/backend/backend_test.go | 21 ++++++------ engine/common/rpc/convert/compatible_range.go | 19 ----------- .../rpc/convert/compatible_range_test.go | 7 ++-- engine/protocol/api.go | 2 +- engine/protocol/mock/api.go | 10 +++--- model/flow/node_version_info.go | 20 ----------- 12 files changed, 68 insertions(+), 76 deletions(-) delete mode 100644 engine/common/rpc/convert/compatible_range.go delete mode 100644 model/flow/node_version_info.go diff --git a/access/api.go b/access/api.go index cc629c12eab..adeb7284c10 100644 --- a/access/api.go +++ b/access/api.go @@ -15,7 +15,7 @@ import ( type API interface { Ping(ctx context.Context) error GetNetworkParameters(ctx context.Context) NetworkParameters - GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) + GetNodeVersionInfo(ctx context.Context) (*NodeVersionInfo, error) GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flow.Header, flow.BlockStatus, error) GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flow.Header, flow.BlockStatus, error) @@ -263,3 +263,34 @@ func MessageToTransactionResult(message *access.TransactionResultResponse) *Tran type NetworkParameters struct { ChainID flow.ChainID } + +// CompatibleRange contains the first and the last height that the version supports. +type CompatibleRange struct { + // The first block that the version supports. + StartHeight uint64 + // The last block that the version supports. + EndHeight uint64 +} + +// NodeVersionInfo contains information about node, such as semver, commit, sporkID, protocolVersion, etc +type NodeVersionInfo struct { + Semver string + Commit string + SporkId flow.Identifier + ProtocolVersion uint64 + SporkRootBlockHeight uint64 + NodeRootBlockHeight uint64 + CompatibleRange *CompatibleRange +} + +// CompatibleRangeToMessage converts a flow.CompatibleRange to a protobuf message +func CompatibleRangeToMessage(c *CompatibleRange) *entities.CompatibleRange { + if c != nil { + return &entities.CompatibleRange{ + StartHeight: c.StartHeight, + EndHeight: c.EndHeight, + } + } + + return nil +} diff --git a/access/handler.go b/access/handler.go index 056568395eb..3007fc6f691 100644 --- a/access/handler.go +++ b/access/handler.go @@ -100,7 +100,7 @@ func (h *Handler) GetNodeVersionInfo( ProtocolVersion: nodeVersionInfo.ProtocolVersion, SporkRootBlockHeight: nodeVersionInfo.SporkRootBlockHeight, NodeRootBlockHeight: nodeVersionInfo.NodeRootBlockHeight, - CompatibleRange: convert.CompatibleRangeToMessage(nodeVersionInfo.CompatibleRange), + CompatibleRange: CompatibleRangeToMessage(nodeVersionInfo.CompatibleRange), }, }, nil } diff --git a/access/mock/api.go b/access/mock/api.go index 18707e00bcd..eaaf6c428f2 100644 --- a/access/mock/api.go +++ b/access/mock/api.go @@ -828,23 +828,23 @@ func (_m *API) GetNetworkParameters(ctx context.Context) access.NetworkParameter } // GetNodeVersionInfo provides a mock function with given fields: ctx -func (_m *API) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) { +func (_m *API) GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error) { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetNodeVersionInfo") } - var r0 *flow.NodeVersionInfo + var r0 *access.NodeVersionInfo var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*flow.NodeVersionInfo, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (*access.NodeVersionInfo, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) *flow.NodeVersionInfo); ok { + if rf, ok := ret.Get(0).(func(context.Context) *access.NodeVersionInfo); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*flow.NodeVersionInfo) + r0 = ret.Get(0).(*access.NodeVersionInfo) } } diff --git a/engine/access/rest/models/node_version_info.go b/engine/access/rest/models/node_version_info.go index 19f5caf2fc4..5be5bb7086c 100644 --- a/engine/access/rest/models/node_version_info.go +++ b/engine/access/rest/models/node_version_info.go @@ -1,11 +1,11 @@ package models import ( + "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/engine/access/rest/util" - "github.com/onflow/flow-go/model/flow" ) -func (t *NodeVersionInfo) Build(params *flow.NodeVersionInfo) { +func (t *NodeVersionInfo) Build(params *access.NodeVersionInfo) { t.Semver = params.Semver t.Commit = params.Commit t.SporkId = params.SporkId.String() diff --git a/engine/access/rest/routes/node_version_info_test.go b/engine/access/rest/routes/node_version_info_test.go index 5ada93a23ec..f08ada0289a 100644 --- a/engine/access/rest/routes/node_version_info_test.go +++ b/engine/access/rest/routes/node_version_info_test.go @@ -9,9 +9,9 @@ import ( mocktestify "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/access/mock" "github.com/onflow/flow-go/cmd/build" - "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/utils/unittest" ) @@ -30,14 +30,14 @@ func TestGetNodeVersionInfo(t *testing.T) { nodeRootBlockHeight := unittest.Uint64InRange(10_000, 100_000) - params := &flow.NodeVersionInfo{ + params := &access.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), SporkId: unittest.IdentifierFixture(), ProtocolVersion: unittest.Uint64InRange(10, 30), SporkRootBlockHeight: unittest.Uint64InRange(1000, 10_000), NodeRootBlockHeight: nodeRootBlockHeight, - CompatibleRange: &flow.CompatibleRange{ + CompatibleRange: &access.CompatibleRange{ StartHeight: nodeRootBlockHeight, EndHeight: uint64(0), }, @@ -54,7 +54,7 @@ func TestGetNodeVersionInfo(t *testing.T) { }) } -func nodeVersionInfoExpectedStr(nodeVersionInfo *flow.NodeVersionInfo) string { +func nodeVersionInfoExpectedStr(nodeVersionInfo *access.NodeVersionInfo) string { compatibleRange := fmt.Sprintf(`"compatible_range": { "start_height": "%d", "end_height": "%d" diff --git a/engine/access/rpc/backend/backend.go b/engine/access/rpc/backend/backend.go index 3df2c087445..184c37e0bcd 100644 --- a/engine/access/rpc/backend/backend.go +++ b/engine/access/rpc/backend/backend.go @@ -343,24 +343,24 @@ func (b *Backend) Ping(ctx context.Context) error { } // GetNodeVersionInfo returns node version information such as semver, commit, sporkID, protocolVersion, etc -func (b *Backend) GetNodeVersionInfo(_ context.Context) (*flow.NodeVersionInfo, error) { +func (b *Backend) GetNodeVersionInfo(_ context.Context) (*access.NodeVersionInfo, error) { sporkID := b.stateParams.SporkID() protocolVersion := b.stateParams.ProtocolVersion() sporkRootBlockHeight := b.stateParams.SporkRootBlockHeight() nodeRootBlockHeader := b.stateParams.SealedRoot() - var compatibleRange *flow.CompatibleRange + var compatibleRange *access.CompatibleRange // Version control feature could be disabled if b.versionControl != nil { - compatibleRange = &flow.CompatibleRange{ + compatibleRange = &access.CompatibleRange{ StartHeight: b.versionControl.StartHeight(), EndHeight: b.versionControl.EndHeight(), } } - nodeInfo := &flow.NodeVersionInfo{ + nodeInfo := &access.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), SporkId: sporkID, diff --git a/engine/access/rpc/backend/backend_test.go b/engine/access/rpc/backend/backend_test.go index caa0f51f46e..4974cbe6ce7 100644 --- a/engine/access/rpc/backend/backend_test.go +++ b/engine/access/rpc/backend/backend_test.go @@ -24,8 +24,9 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "github.com/onflow/flow-go/access" "github.com/onflow/flow-go/cmd/build" - access "github.com/onflow/flow-go/engine/access/mock" + accessmock "github.com/onflow/flow-go/engine/access/mock" backendmock "github.com/onflow/flow-go/engine/access/rpc/backend/mock" "github.com/onflow/flow-go/engine/access/rpc/connection" connectionmock "github.com/onflow/flow-go/engine/access/rpc/connection/mock" @@ -78,9 +79,9 @@ type Suite struct { lastFullBlockHeight *counters.PersistentStrictMonotonicCounter versionControl *version.VersionControl - colClient *access.AccessAPIClient - execClient *access.ExecutionAPIClient - historicalAccessClient *access.AccessAPIClient + colClient *accessmock.AccessAPIClient + execClient *accessmock.ExecutionAPIClient + historicalAccessClient *accessmock.AccessAPIClient connectionFactory *connectionmock.ConnectionFactory communicator *backendmock.Communicator @@ -112,12 +113,12 @@ func (suite *Suite) SetupTest() { suite.collections = new(storagemock.Collections) suite.receipts = new(storagemock.ExecutionReceipts) suite.results = new(storagemock.ExecutionResults) - suite.colClient = new(access.AccessAPIClient) - suite.execClient = new(access.ExecutionAPIClient) + suite.colClient = new(accessmock.AccessAPIClient) + suite.execClient = new(accessmock.ExecutionAPIClient) suite.transactionResults = storagemock.NewLightTransactionResults(suite.T()) suite.events = storagemock.NewEvents(suite.T()) suite.chainID = flow.Testnet - suite.historicalAccessClient = new(access.AccessAPIClient) + suite.historicalAccessClient = new(accessmock.AccessAPIClient) suite.connectionFactory = connectionmock.NewConnectionFactory(suite.T()) suite.communicator = new(backendmock.Communicator) @@ -1593,7 +1594,7 @@ func (suite *Suite) TestGetNodeVersionInfo() { state := protocol.NewState(suite.T()) state.On("Params").Return(stateParams, nil).Maybe() - expected := &flow.NodeVersionInfo{ + expected := &access.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), SporkId: sporkID, @@ -1688,14 +1689,14 @@ func (suite *Suite) TestGetNodeVersionInfo() { state := protocol.NewState(suite.T()) state.On("Params").Return(stateParams, nil).Maybe() - expected := &flow.NodeVersionInfo{ + expected := &access.NodeVersionInfo{ Semver: build.Version(), Commit: build.Commit(), SporkId: sporkID, ProtocolVersion: uint64(protocolVersion), SporkRootBlockHeight: sporkRootBlock.Height, NodeRootBlockHeight: nodeRootBlock.Height, - CompatibleRange: &flow.CompatibleRange{ + CompatibleRange: &access.CompatibleRange{ StartHeight: nodeRootBlock.Height + 12, EndHeight: latestBlockHeight - 9, }, diff --git a/engine/common/rpc/convert/compatible_range.go b/engine/common/rpc/convert/compatible_range.go deleted file mode 100644 index f3063b7aa9a..00000000000 --- a/engine/common/rpc/convert/compatible_range.go +++ /dev/null @@ -1,19 +0,0 @@ -package convert - -import ( - "github.com/onflow/flow/protobuf/go/flow/entities" - - "github.com/onflow/flow-go/model/flow" -) - -// CompatibleRangeToMessage converts a flow.CompatibleRange to a protobuf message -func CompatibleRangeToMessage(c *flow.CompatibleRange) *entities.CompatibleRange { - if c != nil { - return &entities.CompatibleRange{ - StartHeight: c.StartHeight, - EndHeight: c.EndHeight, - } - } - - return nil -} diff --git a/engine/common/rpc/convert/compatible_range_test.go b/engine/common/rpc/convert/compatible_range_test.go index 2fb9467fca2..8424e7256d9 100644 --- a/engine/common/rpc/convert/compatible_range_test.go +++ b/engine/common/rpc/convert/compatible_range_test.go @@ -7,8 +7,7 @@ import ( "github.com/onflow/flow/protobuf/go/flow/entities" "github.com/stretchr/testify/assert" - "github.com/onflow/flow-go/engine/common/rpc/convert" - "github.com/onflow/flow-go/model/flow" + "github.com/onflow/flow-go/access" ) // TestConvertCompatibleRange tests that converting a compatible range to a protobuf message @@ -18,7 +17,7 @@ func TestConvertCompatibleRange(t *testing.T) { startHeight := uint64(rand.Uint32()) endHeight := uint64(rand.Uint32()) - comparableRange := &flow.CompatibleRange{ + comparableRange := &access.CompatibleRange{ StartHeight: startHeight, EndHeight: endHeight, } @@ -27,6 +26,6 @@ func TestConvertCompatibleRange(t *testing.T) { EndHeight: endHeight, } - msg := convert.CompatibleRangeToMessage(comparableRange) + msg := access.CompatibleRangeToMessage(comparableRange) assert.Equal(t, msg, expected) } diff --git a/engine/protocol/api.go b/engine/protocol/api.go index 95d7124b4da..9d3fdb7a853 100644 --- a/engine/protocol/api.go +++ b/engine/protocol/api.go @@ -15,7 +15,7 @@ type NetworkAPI interface { GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error) GetProtocolStateSnapshotByBlockID(ctx context.Context, blockID flow.Identifier) ([]byte, error) GetProtocolStateSnapshotByHeight(ctx context.Context, blockHeight uint64) ([]byte, error) - GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) + GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error) } type API interface { diff --git a/engine/protocol/mock/api.go b/engine/protocol/mock/api.go index c622ca35bc4..f2e4fb175fa 100644 --- a/engine/protocol/mock/api.go +++ b/engine/protocol/mock/api.go @@ -246,23 +246,23 @@ func (_m *API) GetNetworkParameters(ctx context.Context) access.NetworkParameter } // GetNodeVersionInfo provides a mock function with given fields: ctx -func (_m *API) GetNodeVersionInfo(ctx context.Context) (*flow.NodeVersionInfo, error) { +func (_m *API) GetNodeVersionInfo(ctx context.Context) (*access.NodeVersionInfo, error) { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetNodeVersionInfo") } - var r0 *flow.NodeVersionInfo + var r0 *access.NodeVersionInfo var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*flow.NodeVersionInfo, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (*access.NodeVersionInfo, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) *flow.NodeVersionInfo); ok { + if rf, ok := ret.Get(0).(func(context.Context) *access.NodeVersionInfo); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*flow.NodeVersionInfo) + r0 = ret.Get(0).(*access.NodeVersionInfo) } } diff --git a/model/flow/node_version_info.go b/model/flow/node_version_info.go deleted file mode 100644 index a10296283cb..00000000000 --- a/model/flow/node_version_info.go +++ /dev/null @@ -1,20 +0,0 @@ -package flow - -// CompatibleRange contains the first and the last height that the version supports. -type CompatibleRange struct { - // The first block that the version supports. - StartHeight uint64 - // The last block that the version supports. - EndHeight uint64 -} - -// NodeVersionInfo contains information about node, such as semver, commit, sporkID, protocolVersion, etc -type NodeVersionInfo struct { - Semver string - Commit string - SporkId Identifier - ProtocolVersion uint64 - SporkRootBlockHeight uint64 - NodeRootBlockHeight uint64 - CompatibleRange *CompatibleRange -} From 7fee2537bb521262c57f048d8f5dfda96bbab880 Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Tue, 27 Aug 2024 14:49:31 +0300 Subject: [PATCH 22/23] Updated flow-emulator version --- integration/go.mod | 4 ++-- integration/go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index b068d951e4c..7dd8f5b93ea 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -25,7 +25,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f - github.com/onflow/flow-go v0.37.1 + github.com/onflow/flow-go v0.37.7-0.20240826193109-e211841b59f5 github.com/onflow/flow-go-sdk v1.0.0-preview.53 github.com/onflow/flow-go/insecure v0.0.0-00010101000000-000000000000 github.com/onflow/flow/protobuf/go/flow v0.4.6 @@ -364,4 +364,4 @@ replace github.com/onflow/flow-go/insecure => ../insecure replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c // TODO: remove it when merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240826100127-716edf8c9715 +replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240827114313-304fb49c098a diff --git a/integration/go.sum b/integration/go.sum index c1309f4752d..b5c3a542dc2 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,8 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240826100127-716edf8c9715 h1:Hbil1d2AAYLyDe+PPPoSMwMza9i2VwmXmOUFrpbYkTU= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240826100127-716edf8c9715/go.mod h1:4kpN3sLpvPQlHpl+6dLCrb7+e2qGEFsbZc6slI5Yc9Y= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240827114313-304fb49c098a h1:Q3usaZZeDMlGiuCDKI8nAhlTqy0BchD1ykLujFzb240= +github.com/The-K-R-O-K/flow-emulator v0.0.0-20240827114313-304fb49c098a/go.mod h1:Tke5418grUOK+6fGxzXXFgJotL00XqYxtsQa/ivPM0c= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= From 7b26083d7667f4ddc0af2657841b04b3458bf4df Mon Sep 17 00:00:00 2001 From: UlyanaAndrukhiv Date: Wed, 28 Aug 2024 12:32:22 +0300 Subject: [PATCH 23/23] Removed replace for flow-emulator --- integration/go.mod | 3 --- integration/go.sum | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/integration/go.mod b/integration/go.mod index 7dd8f5b93ea..dca9b5c0eee 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -362,6 +362,3 @@ replace github.com/onflow/flow-go/insecure => ../insecure // TODO: remove it when https://github.com/ipfs/go-ds-pebble/pull/36 merged replace github.com/ipfs/go-ds-pebble v0.3.1 => github.com/onflow/go-ds-pebble v0.0.0-20240731130313-f186539f382c - -// TODO: remove it when merged -replace github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f => github.com/The-K-R-O-K/flow-emulator v0.0.0-20240827114313-304fb49c098a diff --git a/integration/go.sum b/integration/go.sum index b5c3a542dc2..dd18cd9047c 100644 --- a/integration/go.sum +++ b/integration/go.sum @@ -999,8 +999,6 @@ github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqR github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240827114313-304fb49c098a h1:Q3usaZZeDMlGiuCDKI8nAhlTqy0BchD1ykLujFzb240= -github.com/The-K-R-O-K/flow-emulator v0.0.0-20240827114313-304fb49c098a/go.mod h1:Tke5418grUOK+6fGxzXXFgJotL00XqYxtsQa/ivPM0c= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= @@ -2153,6 +2151,8 @@ github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1 h1:q9tXLIALwQ76bO4 github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.1/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1 h1:FfhMBAb78p6VAWkJ+iqdKLErGQVQgxk5w6DP5ZruWX8= github.com/onflow/flow-core-contracts/lib/go/templates v1.3.1/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30= +github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f h1:2Ejpmm2Vrl/XLaE6lniE1vNfi6WYhzqHiCk6oomGoFE= +github.com/onflow/flow-emulator v1.0.0-preview.36.0.20240729195722-d4eb1c30eb9f/go.mod h1:0rqp896zEcjNqqDiQNBUlpS/7nzS4+E+yG/4s0P13bQ= github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0= github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs=