Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions consensus/hotstuff/cruisectl/block_time_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func (bs *BlockTimeControllerSuite) EpochDurationSeconds() uint64 {
return 60 * 60
}

// Helper function to allow an initial tick before checking the condition.
func (bs *BlockTimeControllerSuite) EventuallyWithDelay(t require.TestingT, condition func() bool, waitFor time.Duration, tick time.Duration) {
time.Sleep(tick) // initial delay
require.Eventually(t, condition, waitFor, tick)
}

// SetupTest initializes mocks and default values.
func (bs *BlockTimeControllerSuite) SetupTest() {
bs.config = DefaultConfig()
Expand Down Expand Up @@ -245,9 +251,9 @@ func (bs *BlockTimeControllerSuite) TestOnEpochExtended() {
bs.ctl.EpochExtended(bs.epochCounter, header, extension)

// Check component state after the epochEvents channel is empty, indicating the event has been processed.
require.Eventually(bs.T(), func() bool {
bs.EventuallyWithDelay(bs.T(), func() bool {
return len(bs.ctl.epochEvents) == 0
}, time.Second, time.Millisecond)
}, time.Second, 10*time.Millisecond)

currentEpoch, err := bs.snapshot.Epochs().Current()
require.NoError(bs.T(), err)
Expand Down Expand Up @@ -381,9 +387,10 @@ func (bs *BlockTimeControllerSuite) TestEnableDisable() {
// send another block
block = model.BlockFromFlow(unittest.BlockHeaderFixture(unittest.HeaderWithView(bs.initialView + 2)))
bs.ctl.OnBlockIncorporated(block)
require.Eventually(bs.T(), func() bool {

bs.EventuallyWithDelay(bs.T(), func() bool {
return bs.ctl.getProposalTiming().ObservationView() > bs.initialView
}, time.Second, time.Millisecond)
}, time.Second, 10*time.Millisecond)

thirdControllerState := captureControllerStateDigest(bs.ctl)
thirdProposalDelay := bs.ctl.getProposalTiming()
Expand Down
5 changes: 2 additions & 3 deletions engine/execution/provider/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (e *Engine) processQueuedChunkDataPackRequestsShovelerWorker(ctx irrecovera
select {
case <-e.chdpRequestHandler.GetNotifier():
// there is at list a single chunk data pack request queued up.
e.processAvailableMesssages(ctx)
e.processAvailableMessages(ctx)
case <-ctx.Done():
// close the internal channel, the workers will drain the channel before exiting
close(e.chdpRequestChannel)
Expand All @@ -197,7 +197,7 @@ func (e *Engine) processQueuedChunkDataPackRequestsShovelerWorker(ctx irrecovera
// processAvailableMesssages is a blocking method that reads all queued ChunkDataRequests till the queue gets empty.
// Each ChunkDataRequest is processed by a single concurrent worker. However, there are limited number of such workers.
// If there is no worker available for a request, the method blocks till one is available.
func (e *Engine) processAvailableMesssages(ctx irrecoverable.SignalerContext) {
func (e *Engine) processAvailableMessages(ctx irrecoverable.SignalerContext) {
for {
select {
case <-ctx.Done():
Expand All @@ -217,7 +217,6 @@ func (e *Engine) processAvailableMesssages(ctx irrecoverable.SignalerContext) {
// if it does happen, it means there is a bug in the queue implementation.
ctx.Throw(fmt.Errorf("invalid chunk id type in chunk data pack request queue: %T", msg.Payload))
}

request := &mempool.ChunkDataPackRequest{
RequesterId: msg.OriginID,
ChunkId: chunkId,
Expand Down
8 changes: 4 additions & 4 deletions engine/execution/provider/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func TestProviderEngine_onChunkDataRequest(t *testing.T) {
require.NoError(t, e.Process(channels.RequestChunks, originIdentity.NodeID, req))

require.Eventually(t, func() bool {
_, ok := requestQueue.Get() // ensuring all requests have been picked up from the queue.
return !ok
empty := requestQueue.Size() == 0 // ensuring all requests have been picked up from the queue.
return empty
}, 1*time.Second, 10*time.Millisecond)

cancel()
Expand Down Expand Up @@ -103,8 +103,8 @@ func TestProviderEngine_onChunkDataRequest(t *testing.T) {
require.NoError(t, e.Process(channels.RequestChunks, originIdentity.NodeID, req))

require.Eventually(t, func() bool {
_, ok := requestQueue.Get() // ensuring all requests have been picked up from the queue.
return !ok
empty := requestQueue.Size() == 0 // ensuring all requests have been picked up from the queue.
return empty
}, 1*time.Second, 10*time.Millisecond)

cancel()
Expand Down
6 changes: 3 additions & 3 deletions fvm/environment/program_recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ func importsAddressLocation(program *ast.Program, address common.Address, name s
}

// The import declaration imports all identifiers, so also the location
if len(importDeclaration.Identifiers) == 0 {
if len(importDeclaration.Imports) == 0 {
return true
}

// The import declaration imports specific identifiers, so check if the location is imported
for _, identifier := range importDeclaration.Identifiers {
if identifier.Identifier == name {
for _, imp := range importDeclaration.Imports {
if imp.Identifier.Identifier == name {
return true
}
}
Expand Down
54 changes: 27 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/onflow/flow-go
go 1.25.0

require (
cloud.google.com/go/compute/metadata v0.7.0
cloud.google.com/go/compute/metadata v0.8.0
cloud.google.com/go/profiler v0.3.0
cloud.google.com/go/storage v1.50.0
github.com/antihax/optional v1.0.0
github.com/aws/aws-sdk-go-v2/config v1.30.0
github.com/aws/aws-sdk-go-v2/config v1.31.2
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.5.1
github.com/aws/aws-sdk-go-v2/service/s3 v1.15.0
github.com/btcsuite/btcd/btcec/v2 v2.3.4
Expand Down Expand Up @@ -48,12 +48,12 @@ require (
github.com/multiformats/go-multiaddr-dns v0.4.1
github.com/multiformats/go-multihash v0.2.3
github.com/onflow/atree v0.10.1
github.com/onflow/cadence v1.7.0-preview.3
github.com/onflow/cadence v1.7.0
github.com/onflow/crypto v0.25.3
github.com/onflow/flow v0.3.4
github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250825173510-91e6f28b0224
github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250825173510-91e6f28b0224
github.com/onflow/flow-go-sdk v1.7.0
github.com/onflow/flow-go-sdk v1.8.1
github.com/onflow/flow/protobuf/go/flow v0.4.12
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
github.com/pierrec/lz4 v2.6.1+incompatible
Expand All @@ -68,11 +68,11 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.6
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
github.com/vmihailenco/msgpack/v4 v4.3.11
go.opentelemetry.io/otel v1.37.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0
go.opentelemetry.io/otel/sdk v1.36.0
go.opentelemetry.io/otel/sdk v1.37.0
go.opentelemetry.io/otel/trace v1.37.0
go.uber.org/atomic v1.11.0
go.uber.org/multierr v1.11.0
Expand All @@ -83,11 +83,11 @@ require (
golang.org/x/text v0.28.0
golang.org/x/time v0.12.0
golang.org/x/tools v0.36.0
google.golang.org/api v0.241.0
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2
google.golang.org/grpc v1.74.2
google.golang.org/api v0.247.0
google.golang.org/genproto v0.0.0-20250603155806-513f23925822
google.golang.org/grpc v1.75.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0
google.golang.org/protobuf v1.36.6
google.golang.org/protobuf v1.36.7
gotest.tools v2.2.0+incompatible
pgregory.net/rapid v1.1.0
)
Expand All @@ -114,8 +114,8 @@ require (
github.com/sony/gobreaker v0.5.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
google.golang.org/genproto/googleapis/api v0.0.0-20250528174236-200df99c418a
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250603155806-513f23925822
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7
google.golang.org/genproto/googleapis/bytestream v0.0.0-20250804133106-a7a43d27e69b
gopkg.in/yaml.v2 v2.4.0
)

Expand All @@ -129,12 +129,12 @@ require (
require (
cel.dev/expr v0.24.0 // indirect
cloud.google.com/go v0.120.0 // indirect
cloud.google.com/go/auth v0.16.2 // indirect
cloud.google.com/go/auth v0.16.4 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/iam v1.5.2 // indirect
cloud.google.com/go/monitoring v1.24.2 // indirect
github.com/DataDog/zstd v1.5.6-0.20230824185856-869dae002e5e // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.27.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.50.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.50.0 // indirect
github.com/Jorropo/jsync v1.0.1 // indirect
Expand All @@ -143,18 +143,18 @@ require (
github.com/SaveTheRbtz/mph v0.1.1-0.20240117162131-4166ec7869bc // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/aws/aws-sdk-go-v2 v1.37.0 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.18.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.17.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.38.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.18.6 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.7.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.26.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.31.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.35.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.28.2 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.33.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.38.0 // indirect
github.com/aws/smithy-go v1.22.5 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -195,7 +195,7 @@ require (
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
github.com/gammazero/deque v1.0.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/go-jose/go-jose/v4 v4.1.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
Expand All @@ -211,7 +211,7 @@ require (
github.com/google/gopacket v1.1.19 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.14.2 // indirect
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down Expand Up @@ -340,7 +340,7 @@ require (
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.36.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
go.uber.org/dig v1.18.0 // indirect
go.uber.org/fx v1.23.0 // indirect
Expand All @@ -352,7 +352,7 @@ require (
golang.org/x/term v0.34.0 // indirect
gonum.org/v1/gonum v0.16.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.4.1 // indirect
Expand Down
Loading
Loading