Skip to content

Commit

Permalink
Merge branch 'master' into auto-update-onflow-cadence-v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Jan 17, 2025
2 parents f8499f0 + a3c2cea commit 43ae10b
Show file tree
Hide file tree
Showing 276 changed files with 7,691 additions and 3,564 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.54
version: v1.63
args: -v
working-directory: ${{ matrix.dir }}
# https://github.com/golangci/golangci-lint-action/issues/244
Expand Down Expand Up @@ -336,6 +336,9 @@ jobs:
- name: Access Cohort3 Integration Tests
make: make -C integration access-cohort3-tests
runner: ubuntu-latest
- name: Access Cohort4 Integration Tests
make: make -C integration access-cohort4-tests
runner: ubuntu-latest
# test suite has single test which is flaky and needs to be fixed - reminder here to put it back when it's fixed
# - name: BFT (Framework) Integration Tests
# make: make -C integration bft-framework-tests
Expand Down
54 changes: 4 additions & 50 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,51 +1,5 @@
# Collection Stream
/cmd/collection/** @jordanschalm
/engine/collection/** @jordanschalm
/protobuf/services/collection/** @jordanschalm
# Protocol owners are not generally differentiated by sub-area for simplicity
/** @onflow/flow-core-protocol

# Consensus Stream
/cmd/consensus/** @AlexHentschel @durkmurder @jordanschalm
/engine/consensus/** @AlexHentschel @durkmurder @jordanschalm

# Execution Stream
/cmd/execution/** @zhangchiqing
/engine/execution/** @zhangchiqing

# Access Stream
/access/** @peterargue
/cmd/access/** @peterargue
/cmd/observer/** @peterargue
/engine/access/** @peterargue

# Verification Stream
/cmd/verification/** @zhangchiqing
/engine/verification/** @zhangchiqing
/integration/tests/verification @zhangchiqing

# Ledger Stream
/ledger/** @AlexHentschel

# FVM Stream
/fvm/** @janezpodhostnik

# Networking Stream
/network/** @Kay-Zee

# Cryptography Stream
/crypto/** @tarakby

# Bootstrap and transit scripts
/cmd/bootstrap/** @zhangchiqing

# Dev Tools Stream
.github/workflows/** @Kay-Zee
/insecure/** @Kay-Zee
/integration/benchnet2/** @Kay-Zee
/tools/test_monitor/** @Kay-Zee

# Performance Stream
/integration/benchmark/** @Kay-Zee

# Execution Sync
/module/executiondatasync/** @peterargue
/module/state_synchronization/** @peterargue
# FVM specific
/fvm/** @janezpodhostnik @zhangchiqing
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ generate-mocks: install-mock-generators
mockery --name 'BlockTracker' --dir="./engine/access/subscription" --case=underscore --output="./engine/access/subscription/mock" --outpkg="mock"
mockery --name 'DataProvider' --dir="./engine/access/rest/websockets/data_providers" --case=underscore --output="./engine/access/rest/websockets/data_providers/mock" --outpkg="mock"
mockery --name 'DataProviderFactory' --dir="./engine/access/rest/websockets/data_providers" --case=underscore --output="./engine/access/rest/websockets/data_providers/mock" --outpkg="mock"
mockery --name 'LinkGenerator' --dir="./engine/access/rest/common/models" --case=underscore --output="./engine/access/rest/common/models/mock" --outpkg="mock"
mockery --name 'WebsocketConnection' --dir="./engine/access/rest/websockets" --case=underscore --output="./engine/access/rest/websockets/mock" --outpkg="mock"
mockery --name 'ExecutionDataTracker' --dir="./engine/access/subscription" --case=underscore --output="./engine/access/subscription/mock" --outpkg="mock"
mockery --name 'ConnectionFactory' --dir="./engine/access/rpc/connection" --case=underscore --output="./engine/access/rpc/connection/mock" --outpkg="mock"
Expand All @@ -216,7 +217,6 @@ generate-mocks: install-mock-generators
mockery --name 'Storage' --dir=module/executiondatasync/tracker --case=underscore --output="module/executiondatasync/tracker/mock" --outpkg="mocktracker"
mockery --name 'ScriptExecutor' --dir=module/execution --case=underscore --output="module/execution/mock" --outpkg="mock"
mockery --name 'StorageSnapshot' --dir=fvm/storage/snapshot --case=underscore --output="fvm/storage/snapshot/mock" --outpkg="mock"
mockery --name 'WebsocketConnection' --dir=engine/access/rest/websockets --case=underscore --output="engine/access/rest/websockets/mock" --outpkg="mock"

#temporarily make insecure/ a non-module to allow mockery to create mocks
mv insecure/go.mod insecure/go2.mod
Expand Down
48 changes: 44 additions & 4 deletions access/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,50 @@ type API interface {
//
// If invalid parameters will be supplied SubscribeBlockDigestsFromLatest will return a failed subscription.
SubscribeBlockDigestsFromLatest(ctx context.Context, blockStatus flow.BlockStatus) subscription.Subscription
// SubscribeTransactionStatuses streams transaction statuses starting from the reference block saved in the
// transaction itself until the block containing the transaction becomes sealed or expired. When the transaction
// status becomes TransactionStatusSealed or TransactionStatusExpired, the subscription will automatically shut down.
SubscribeTransactionStatuses(ctx context.Context, tx *flow.TransactionBody, requiredEventEncodingVersion entities.EventEncodingVersion) subscription.Subscription
// SubscribeTransactionStatusesFromStartBlockID subscribes to transaction status updates for a given transaction ID.
// Monitoring begins from the specified block ID. The subscription streams status updates until the transaction
// reaches a final state (TransactionStatusSealed or TransactionStatusExpired). When the transaction reaches one of
// these final statuses, the subscription will automatically terminate.
//
// Parameters:
// - ctx: The context to manage the subscription's lifecycle, including cancellation.
// - txID: The identifier of the transaction to monitor.
// - startBlockID: The block ID from which to start monitoring.
// - requiredEventEncodingVersion: The version of event encoding required for the subscription.
SubscribeTransactionStatusesFromStartBlockID(ctx context.Context, txID flow.Identifier, startBlockID flow.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion) subscription.Subscription
// SubscribeTransactionStatusesFromStartHeight subscribes to transaction status updates for a given transaction ID.
// Monitoring begins from the specified block height. The subscription streams status updates until the transaction
// reaches a final state (TransactionStatusSealed or TransactionStatusExpired). When the transaction reaches one of
// these final statuses, the subscription will automatically terminate.
//
// Parameters:
// - ctx: The context to manage the subscription's lifecycle, including cancellation.
// - txID: The unique identifier of the transaction to monitor.
// - startHeight: The block height from which to start monitoring.
// - requiredEventEncodingVersion: The version of event encoding required for the subscription.
SubscribeTransactionStatusesFromStartHeight(ctx context.Context, txID flow.Identifier, startHeight uint64, requiredEventEncodingVersion entities.EventEncodingVersion) subscription.Subscription
// SubscribeTransactionStatusesFromLatest subscribes to transaction status updates for a given transaction ID.
// Monitoring begins from the latest block. The subscription streams status updates until the transaction
// reaches a final state (TransactionStatusSealed or TransactionStatusExpired). When the transaction reaches one of
// these final statuses, the subscription will automatically terminate.
//
// Parameters:
// - ctx: The context to manage the subscription's lifecycle, including cancellation.
// - txID: The unique identifier of the transaction to monitor.
// - requiredEventEncodingVersion: The version of event encoding required for the subscription.
SubscribeTransactionStatusesFromLatest(ctx context.Context, txID flow.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion) subscription.Subscription
// SendAndSubscribeTransactionStatuses sends a transaction to the network and subscribes to its status updates.
// Monitoring begins from the reference block saved in the transaction itself and streams status updates until the transaction
// reaches a final state (TransactionStatusSealed or TransactionStatusExpired). Once a final status is reached, the subscription
// automatically terminates.
//
// Parameters:
// - ctx: The context to manage the transaction sending and subscription lifecycle, including cancellation.
// - tx: The transaction body to be sent and monitored.
// - requiredEventEncodingVersion: The version of event encoding required for the subscription.
//
// If the transaction cannot be sent, the subscription will fail and return a failed subscription.
SendAndSubscribeTransactionStatuses(ctx context.Context, tx *flow.TransactionBody, requiredEventEncodingVersion entities.EventEncodingVersion) subscription.Subscription
}

// TODO: Combine this with flow.TransactionResult?
Expand Down
7 changes: 1 addition & 6 deletions access/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1425,12 +1425,7 @@ func (h *Handler) SendAndSubscribeTransactionStatuses(
return status.Error(codes.InvalidArgument, err.Error())
}

err = h.api.SendTransaction(ctx, &tx)
if err != nil {
return err
}

sub := h.api.SubscribeTransactionStatuses(ctx, &tx, request.GetEventEncodingVersion())
sub := h.api.SendAndSubscribeTransactionStatuses(ctx, &tx, request.GetEventEncodingVersion())

messageIndex := counters.NewMonotonousCounter(0)
return subscription.HandleRPCSubscription(sub, func(txResults []*TransactionResult) error {
Expand Down
72 changes: 66 additions & 6 deletions access/mock/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion cmd/access/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"context"

"github.com/onflow/flow-go/cmd"
nodebuilder "github.com/onflow/flow-go/cmd/access/node_builder"
"github.com/onflow/flow-go/model/flow"
Expand All @@ -24,5 +26,5 @@ func main() {
if err != nil {
builder.Logger.Fatal().Err(err).Send()
}
node.Run()
node.Run(context.Background())
}
14 changes: 11 additions & 3 deletions cmd/access/node_builder/access_node_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import (
"github.com/onflow/flow-go/engine/access/rest"
commonrest "github.com/onflow/flow-go/engine/access/rest/common"
"github.com/onflow/flow-go/engine/access/rest/router"
"github.com/onflow/flow-go/engine/access/rest/websockets"
"github.com/onflow/flow-go/engine/access/rpc"
"github.com/onflow/flow-go/engine/access/rpc/backend"
rpcConnection "github.com/onflow/flow-go/engine/access/rpc/connection"
Expand All @@ -62,6 +63,7 @@ import (
"github.com/onflow/flow-go/engine/common/stop"
synceng "github.com/onflow/flow-go/engine/common/synchronization"
"github.com/onflow/flow-go/engine/common/version"
"github.com/onflow/flow-go/engine/execution/computation"
"github.com/onflow/flow-go/engine/execution/computation/query"
"github.com/onflow/flow-go/fvm/storage/derived"
"github.com/onflow/flow-go/ledger"
Expand Down Expand Up @@ -227,8 +229,9 @@ func DefaultAccessNodeConfig() *AccessNodeConfig {
IdleTimeout: rest.DefaultIdleTimeout,
MaxRequestSize: commonrest.DefaultMaxRequestSize,
},
MaxMsgSize: grpcutils.DefaultMaxMsgSize,
CompressorName: grpcutils.NoCompressor,
MaxMsgSize: grpcutils.DefaultMaxMsgSize,
CompressorName: grpcutils.NoCompressor,
WebSocketConfig: websockets.NewDefaultWebsocketConfig(),
},
stateStreamConf: statestreambackend.Config{
MaxExecutionDataMsgSize: grpcutils.DefaultMaxMsgSize,
Expand Down Expand Up @@ -989,7 +992,7 @@ func (builder *FlowAccessNodeBuilder) BuildExecutionSyncComponents() *FlowAccess
builder.Logger,
metrics.NewExecutionCollector(builder.Tracer),
builder.RootChainID,
query.NewProtocolStateWrapper(builder.State),
computation.NewProtocolStateWrapper(builder.State),
builder.Storage.Headers,
builder.ExecutionIndexerCore.RegisterValue,
builder.scriptExecutorConfig,
Expand Down Expand Up @@ -1450,6 +1453,11 @@ func (builder *FlowAccessNodeBuilder) extraFlags() {
"registerdb-pruning-threshold",
defaultConfig.registerDBPruneThreshold,
fmt.Sprintf("specifies the number of blocks below the latest stored block height to keep in register db. default: %d", defaultConfig.registerDBPruneThreshold))

flags.DurationVar(&builder.rpcConf.WebSocketConfig.InactivityTimeout,
"websocket-inactivity-timeout",
defaultConfig.rpcConf.WebSocketConfig.InactivityTimeout,
"specifies the duration a WebSocket connection can remain open without any active subscriptions before being automatically closed")
}).ValidateFlags(func() error {
if builder.supportsObserver && (builder.PublicNetworkConfig.BindAddress == cmd.NotSet || builder.PublicNetworkConfig.BindAddress == "") {
return errors.New("public-network-address must be set if supports-observer is true")
Expand Down
5 changes: 3 additions & 2 deletions cmd/collection/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"fmt"
"time"

Expand Down Expand Up @@ -480,7 +481,7 @@ func main() {
node.EngineRegistry,
node.State,
node.Metrics.Engine,
colMetrics,
node.Metrics.Mempool,
node.Me,
node.Storage.Collections,
node.Storage.Transactions,
Expand Down Expand Up @@ -646,7 +647,7 @@ func main() {
if err != nil {
nodeBuilder.Logger.Fatal().Err(err).Send()
}
node.Run()
node.Run(context.Background())
}

// createQCContractClient creates QC contract client
Expand Down
3 changes: 2 additions & 1 deletion cmd/consensus/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -933,7 +934,7 @@ func main() {
if err != nil {
nodeBuilder.Logger.Fatal().Err(err).Send()
}
node.Run()
node.Run(context.Background())
}

func loadBeaconPrivateKey(dir string, myID flow.Identifier) (*encodable.RandomBeaconPrivKey, error) {
Expand Down
4 changes: 3 additions & 1 deletion cmd/execution/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"context"

"github.com/onflow/flow-go/cmd"
"github.com/onflow/flow-go/model/flow"
)
Expand All @@ -19,5 +21,5 @@ func main() {
if err != nil {
exeBuilder.FlowNodeBuilder.Logger.Fatal().Err(err).Send()
}
node.Run()
node.Run(context.Background())
}
Loading

0 comments on commit 43ae10b

Please sign in to comment.