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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
workflow_dispatch:

env:
GO_VERSION: "1.26"
GO_VERSION: "1.25"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flaky-test-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
contents: read

env:
GO_VERSION: "1.26"
GO_VERSION: "1.25"
BIGQUERY_DATASET: dev_src_flow_test_metrics
BIGQUERY_TABLE: skipped_tests
BIGQUERY_TABLE2: test_results
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
type: string

env:
GO_VERSION: "1.26"
GO_VERSION: "1.25"
PRIVATE_REGISTRY_HOST: us-central1-docker.pkg.dev

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: boolean

env:
GO_VERSION: "1.26"
GO_VERSION: "1.25"

jobs:
build-publish:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The following table lists all work streams and links to their home directory and
## Installation

- Clone this repository
- Install [Go](https://golang.org/doc/install) (Flow requires Go 1.26 and later)
- Install [Go](https://golang.org/doc/install) (Flow requires Go 1.25 and later)
- Install [Docker](https://docs.docker.com/get-docker/), which is used for running a local network and integration tests
- Make sure the [`GOPATH`](https://golang.org/cmd/go/#hdr-GOPATH_environment_variable) and `GOBIN` environment variables
are set, and `GOBIN` is added to your path:
Expand Down Expand Up @@ -220,7 +220,7 @@ flow-go is the **protocol / node** implementation. [`onflow/cadence`](https://gi
Access, Collection, Consensus, Execution, and Verification. Each has its own entry point under `/cmd/`. There is also an Observer service for staking-free read-only access.

### Which Go version does flow-go require?
Go 1.26 or later. See the [Installation](#installation) section for the full environment setup.
Go 1.25 or later. See the [Installation](#installation) section for the full environment setup.

### Where is the consensus algorithm implemented?
Under [`/consensus/hotstuff`](/consensus/hotstuff). HotStuff is the BFT consensus family used by Flow.
Expand Down
5 changes: 3 additions & 2 deletions admin/command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/tls"
"errors"
"fmt"
"maps"
"net"
"net/http"
"net/http/pprof"
Expand Down Expand Up @@ -92,7 +91,9 @@ func (r *CommandRunnerBootstrapper) Bootstrap(logger zerolog.Logger, bindAddress
}

validators := make(map[string]CommandValidator)
maps.Copy(validators, r.validators)
for command, validator := range r.validators {
validators[command] = validator
}

commandRunner := &CommandRunner{
handlers: handlers,
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/collection/tx_rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func NewTxRateLimitCommand(limiter *ingest.AddressRateLimiter) *TxRateLimitComma
}
}

func (s *TxRateLimitCommand) Handler(_ context.Context, req *admin.CommandRequest) (any, error) {
input, ok := req.Data.(map[string]any)
func (s *TxRateLimitCommand) Handler(_ context.Context, req *admin.CommandRequest) (interface{}, error) {
input, ok := req.Data.(map[string]interface{})
if !ok {
return admin.NewInvalidAdminReqFormatError("expected { \"command\": \"add|remove|get|get_config|set_config\", \"addresses\": \"addresses\""), nil
}
Expand Down
2 changes: 1 addition & 1 deletion admin/commands/common/get_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type validatedGetConfigData struct {
field updatable_configs.Field
}

func (s *GetConfigCommand) Handler(_ context.Context, req *admin.CommandRequest) (any, error) {
func (s *GetConfigCommand) Handler(_ context.Context, req *admin.CommandRequest) (interface{}, error) {
validatedReq := req.ValidatorData.(validatedGetConfigData)
curValue := validatedReq.field.Get()
return curValue, nil
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/common/get_identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type GetIdentityCommand struct {
idProvider module.IdentityProvider
}

func (r *GetIdentityCommand) Handler(ctx context.Context, req *admin.CommandRequest) (any, error) {
func (r *GetIdentityCommand) Handler(ctx context.Context, req *admin.CommandRequest) (interface{}, error) {
data := req.ValidatorData.(*getIdentityRequestData)

if data.requestType == FlowID {
Expand All @@ -53,7 +53,7 @@ func (r *GetIdentityCommand) Handler(ctx context.Context, req *admin.CommandRequ
// Validator validates the request.
// Returns admin.InvalidAdminReqError for invalid/malformed requests.
func (r *GetIdentityCommand) Validator(req *admin.CommandRequest) error {
input, ok := req.Data.(map[string]any)
input, ok := req.Data.(map[string]interface{})
if !ok {
return admin.NewInvalidAdminReqFormatError("expected map[string]any")
}
Expand Down
2 changes: 1 addition & 1 deletion admin/commands/common/list_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func NewListConfigCommand(configs *updatable_configs.Manager) *ListConfigCommand
}
}

func (s *ListConfigCommand) Handler(_ context.Context, _ *admin.CommandRequest) (any, error) {
func (s *ListConfigCommand) Handler(_ context.Context, _ *admin.CommandRequest) (interface{}, error) {
fields := s.configs.AllFields()

// create a response
Expand Down
6 changes: 3 additions & 3 deletions admin/commands/common/read_protocol_state_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (r *ReadProtocolStateBlocksCommand) getBlockByHeader(header *flow.Header) (
return block, nil
}

func (r *ReadProtocolStateBlocksCommand) Handler(_ context.Context, req *admin.CommandRequest) (any, error) {
func (r *ReadProtocolStateBlocksCommand) Handler(_ context.Context, req *admin.CommandRequest) (interface{}, error) {
data := req.ValidatorData.(*requestData)
var result []*flow.Block
var block *flow.Block
Expand Down Expand Up @@ -132,7 +132,7 @@ func (r *ReadProtocolStateBlocksCommand) Handler(_ context.Context, req *admin.C
result = append(result, block)
}

var resultList []any
var resultList []interface{}
bytes, err := json.Marshal(result)
if err != nil {
return nil, err
Expand All @@ -145,7 +145,7 @@ func (r *ReadProtocolStateBlocksCommand) Handler(_ context.Context, req *admin.C
// Validator validates the request.
// Returns admin.InvalidAdminReqError for invalid/malformed requests.
func (r *ReadProtocolStateBlocksCommand) Validator(req *admin.CommandRequest) error {
input, ok := req.Data.(map[string]any)
input, ok := req.Data.(map[string]interface{})
if !ok {
return admin.NewInvalidAdminReqFormatError("expected map[string]any")
}
Expand Down
32 changes: 16 additions & 16 deletions admin/commands/common/read_protocol_state_blocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,70 +125,70 @@ func (suite *ReadProtocolStateBlocksSuite) TestValidateInvalidFormat() {
Data: "foo",
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"blah": 123,
},
}))
}

func (suite *ReadProtocolStateBlocksSuite) TestValidateInvalidBlock() {
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": true,
},
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": "",
},
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": "uhznms",
},
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": "deadbeef",
},
}))
}

func (suite *ReadProtocolStateBlocksSuite) TestValidateInvalidBlockHeight() {
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": float64(-1),
},
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": float64(1.1),
},
}))
}

func (suite *ReadProtocolStateBlocksSuite) TestValidateInvalidN() {
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": 1,
"n": "foo",
},
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": 1,
"n": float64(1.1),
},
}))
assert.Error(suite.T(), suite.command.Validator(&admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"block": 1,
"n": float64(0),
},
}))
}

func (suite *ReadProtocolStateBlocksSuite) getBlocks(reqData map[string]any) []*flow.Block {
func (suite *ReadProtocolStateBlocksSuite) getBlocks(reqData map[string]interface{}) []*flow.Block {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand All @@ -208,15 +208,15 @@ func (suite *ReadProtocolStateBlocksSuite) getBlocks(reqData map[string]any) []*
}

func (suite *ReadProtocolStateBlocksSuite) TestHandleFinal() {
blocks := suite.getBlocks(map[string]any{
blocks := suite.getBlocks(map[string]interface{}{
"block": "final",
})
require.Len(suite.T(), blocks, 1)
require.EqualValues(suite.T(), blocks[0], suite.final)
}

func (suite *ReadProtocolStateBlocksSuite) TestHandleSealed() {
blocks := suite.getBlocks(map[string]any{
blocks := suite.getBlocks(map[string]interface{}{
"block": "sealed",
})
require.Len(suite.T(), blocks, 1)
Expand All @@ -225,7 +225,7 @@ func (suite *ReadProtocolStateBlocksSuite) TestHandleSealed() {

func (suite *ReadProtocolStateBlocksSuite) TestHandleHeight() {
for i, block := range suite.allBlocks {
responseBlocks := suite.getBlocks(map[string]any{
responseBlocks := suite.getBlocks(map[string]interface{}{
"block": float64(i),
})
require.Len(suite.T(), responseBlocks, 1)
Expand All @@ -235,7 +235,7 @@ func (suite *ReadProtocolStateBlocksSuite) TestHandleHeight() {

func (suite *ReadProtocolStateBlocksSuite) TestHandleID() {
for _, block := range suite.allBlocks {
responseBlocks := suite.getBlocks(map[string]any{
responseBlocks := suite.getBlocks(map[string]interface{}{
"block": block.ID().String(),
})
require.Len(suite.T(), responseBlocks, 1)
Expand All @@ -244,7 +244,7 @@ func (suite *ReadProtocolStateBlocksSuite) TestHandleID() {
}

func (suite *ReadProtocolStateBlocksSuite) TestHandleNExceedsRootBlock() {
responseBlocks := suite.getBlocks(map[string]any{
responseBlocks := suite.getBlocks(map[string]interface{}{
"block": "final",
"n": float64(len(suite.allBlocks) + 1),
})
Expand Down
2 changes: 1 addition & 1 deletion admin/commands/common/set_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type validatedSetConfigData struct {
value any
}

func (s *SetConfigCommand) Handler(_ context.Context, req *admin.CommandRequest) (any, error) {
func (s *SetConfigCommand) Handler(_ context.Context, req *admin.CommandRequest) (interface{}, error) {
validatedReq := req.ValidatorData.(validatedSetConfigData)

oldValue := validatedReq.field.Get()
Expand Down
2 changes: 1 addition & 1 deletion admin/commands/common/set_golog_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var _ commands.AdminCommand = (*SetGologLevelCommand)(nil)

type SetGologLevelCommand struct{}

func (s *SetGologLevelCommand) Handler(ctx context.Context, req *admin.CommandRequest) (any, error) {
func (s *SetGologLevelCommand) Handler(ctx context.Context, req *admin.CommandRequest) (interface{}, error) {
level := req.ValidatorData.(golog.LogLevel)
golog.SetAllLoggers(level)

Expand Down
2 changes: 1 addition & 1 deletion admin/commands/common/set_log_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var _ commands.AdminCommand = (*SetLogLevelCommand)(nil)

type SetLogLevelCommand struct{}

func (s *SetLogLevelCommand) Handler(_ context.Context, req *admin.CommandRequest) (any, error) {
func (s *SetLogLevelCommand) Handler(_ context.Context, req *admin.CommandRequest) (interface{}, error) {
level := req.ValidatorData.(zerolog.Level)
zerolog.SetGlobalLevel(level)

Expand Down
2 changes: 1 addition & 1 deletion admin/commands/execution/checkpoint_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewTriggerCheckpointCommand(trigger *atomic.Bool, ledgerServiceAddr, ledger
}
}

func (s *TriggerCheckpointCommand) Handler(_ context.Context, _ *admin.CommandRequest) (any, error) {
func (s *TriggerCheckpointCommand) Handler(_ context.Context, _ *admin.CommandRequest) (interface{}, error) {
if s.trigger.CompareAndSwap(false, true) {
log.Info().Msgf("admintool: trigger checkpoint as soon as finishing writing the current segment file. you can find log about 'compactor' to check the checkpointing progress")
} else {
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/execution/stop_at_height.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type StopAtHeightReq struct {
// Handler method sets the stop height parameters.
// Errors only if setting of stop height parameters fails.
// Returns "ok" if successful.
func (s *StopAtHeightCommand) Handler(_ context.Context, req *admin.CommandRequest) (any, error) {
func (s *StopAtHeightCommand) Handler(_ context.Context, req *admin.CommandRequest) (interface{}, error) {
sah := req.ValidatorData.(StopAtHeightReq)

oldParams := s.stopControl.GetStopParameters()
Expand Down Expand Up @@ -66,7 +66,7 @@ func (s *StopAtHeightCommand) Handler(_ context.Context, req *admin.CommandReque
// * `admin.InvalidAdminReqError` if any required field is missing or in a wrong format
func (s *StopAtHeightCommand) Validator(req *admin.CommandRequest) error {

input, ok := req.Data.(map[string]any)
input, ok := req.Data.(map[string]interface{})
if !ok {
return admin.NewInvalidAdminReqFormatError("expected map[string]any")
}
Expand Down
10 changes: 5 additions & 5 deletions admin/commands/execution/stop_at_height_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestCommandParsing(t *testing.T) {
t.Run("happy path", func(t *testing.T) {

req := &admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"height": float64(21), // raw json parses to float64
"crash": true,
},
Expand All @@ -40,7 +40,7 @@ func TestCommandParsing(t *testing.T) {
t.Run("empty", func(t *testing.T) {

req := &admin.CommandRequest{
Data: map[string]any{},
Data: map[string]interface{}{},
}

err := cmd.Validator(req)
Expand All @@ -51,7 +51,7 @@ func TestCommandParsing(t *testing.T) {
t.Run("wrong height type", func(t *testing.T) {

req := &admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"height": "abc",
},
}
Expand All @@ -64,7 +64,7 @@ func TestCommandParsing(t *testing.T) {
t.Run("wrong height type", func(t *testing.T) {

req := &admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"height": "abc",
},
}
Expand All @@ -77,7 +77,7 @@ func TestCommandParsing(t *testing.T) {
t.Run("negative", func(t *testing.T) {

req := &admin.CommandRequest{
Data: map[string]any{
Data: map[string]interface{}{
"height": -12,
},
}
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/state_synchronization/execute_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ExecuteScriptCommand struct {
scriptExecutor execution.ScriptExecutor
}

func (e *ExecuteScriptCommand) Handler(ctx context.Context, req *admin.CommandRequest) (any, error) {
func (e *ExecuteScriptCommand) Handler(ctx context.Context, req *admin.CommandRequest) (interface{}, error) {
d := req.ValidatorData.(*scriptData)

result, err := e.scriptExecutor.ExecuteAtBlockHeight(context.Background(), d.script, d.arguments, d.height)
Expand All @@ -36,7 +36,7 @@ func (e *ExecuteScriptCommand) Handler(ctx context.Context, req *admin.CommandRe
// Validator validates the request.
// Returns admin.InvalidAdminReqError for invalid/malformed requests.
func (e *ExecuteScriptCommand) Validator(req *admin.CommandRequest) error {
input, ok := req.Data.(map[string]any)
input, ok := req.Data.(map[string]interface{})
if !ok {
return admin.NewInvalidAdminReqFormatError("expected map[string]any")
}
Expand Down
Loading
Loading