Skip to content

Commit ecf7482

Browse files
committed
Merge branch 'master' into leo/refactor-index-cluster-height
2 parents e876f64 + ef71573 commit ecf7482

File tree

742 files changed

+7258
-7555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

742 files changed

+7258
-7555
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ jobs:
321321
username: ${{ vars.DOCKERHUB_USERNAME }}
322322
password: ${{ secrets.DOCKERHUB_TOKEN }}
323323
if: ${{ (github.event_name == 'merge_group' || (github.event.pull_request && (github.event.pull_request.author_association == 'MEMBER' || github.event.pull_request.author_association == 'COLLABORATOR'))) }}
324+
# this docker auth is exclusively for higher rate limits. continue unauthenticated if it fails
325+
continue-on-error: true
324326

325327

326328
- name: Docker build

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ run:
33

44
linters-settings:
55
goimports:
6+
# enforced by linter
67
# put imports beginning with prefix after 3rd-party packages;
78
# it's a comma-separated list of prefixes
89
local-prefixes: github.com/onflow/flow-go/
910

11+
# used to generate canonical import ordering
12+
# not enforced by linter
13+
gci:
14+
sections:
15+
- standard # 1. standard library
16+
- default # 2. external packages
17+
- prefix(github.com/onflow/) # 3. org packages
18+
- prefix(github.com/onflow/flow-go/) # 4. project packages
19+
skip-generated: true
20+
custom-order: true
21+
1022
gosec:
1123
# To select a subset of rules to run.
1224
# Available rules: https://github.com/securego/gosec#available-rules

.mockery.yaml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
dir: "{{.InterfaceDir}}/mock"
2+
outpkg: "mock"
3+
filename: "{{.InterfaceName | snakecase}}.go"
4+
mockname: "{{.InterfaceName}}"
5+
6+
all: True
7+
with-expecter: False
8+
include-auto-generated: False
9+
disable-func-mocks: True
10+
fail-on-missing: True
11+
12+
# Suppress warnings
13+
issue-845-fix: True
14+
disable-version-string: True
15+
resolve-type-alias: False
16+
17+
packages:
18+
github.com/onflow/flow-go/access:
19+
github.com/onflow/flow-go/access/validator:
20+
github.com/onflow/flow-go/cmd/util/ledger/reporters:
21+
github.com/onflow/flow-go/consensus/hotstuff:
22+
config:
23+
dir: "consensus/hotstuff/mocks"
24+
outpkg: "mocks"
25+
github.com/onflow/flow-go/engine/access/ingestion/tx_error_messages:
26+
github.com/onflow/flow-go/engine/access/rest/common/models:
27+
github.com/onflow/flow-go/engine/access/rest/websockets:
28+
github.com/onflow/flow-go/engine/access/rest/websockets/data_providers:
29+
github.com/onflow/flow-go/engine/access/rpc/backend/accounts/provider:
30+
github.com/onflow/flow-go/engine/access/rpc/backend/events/provider:
31+
github.com/onflow/flow-go/engine/access/rpc/backend/node_communicator:
32+
github.com/onflow/flow-go/engine/access/rpc/backend/transactions/error_messages:
33+
github.com/onflow/flow-go/engine/access/rpc/backend/transactions/provider:
34+
github.com/onflow/flow-go/engine/access/rpc/backend/transactions/retrier:
35+
github.com/onflow/flow-go/engine/access/rpc/connection:
36+
github.com/onflow/flow-go/engine/access/state_stream:
37+
github.com/onflow/flow-go/engine/access/subscription:
38+
github.com/onflow/flow-go/engine/access/subscription/tracker:
39+
github.com/onflow/flow-go/engine/access/wrapper:
40+
config:
41+
dir: "engine/access/mock"
42+
github.com/onflow/flow-go/engine/collection:
43+
github.com/onflow/flow-go/engine/collection/epochmgr:
44+
github.com/onflow/flow-go/engine/collection/rpc:
45+
github.com/onflow/flow-go/engine/common/follower:
46+
interfaces:
47+
complianceCore:
48+
config:
49+
exported: true
50+
mockname: "{{.InterfaceName | firstUpper}}"
51+
github.com/onflow/flow-go/engine/common/follower/cache:
52+
github.com/onflow/flow-go/engine/consensus:
53+
github.com/onflow/flow-go/engine/consensus/approvals:
54+
github.com/onflow/flow-go/engine/execution:
55+
github.com/onflow/flow-go/engine/execution/computation:
56+
github.com/onflow/flow-go/engine/execution/computation/computer:
57+
github.com/onflow/flow-go/engine/execution/computation/query:
58+
github.com/onflow/flow-go/engine/execution/ingestion/uploader:
59+
github.com/onflow/flow-go/engine/execution/provider:
60+
github.com/onflow/flow-go/engine/execution/state:
61+
github.com/onflow/flow-go/engine/protocol:
62+
github.com/onflow/flow-go/engine/verification/fetcher:
63+
github.com/onflow/flow-go/fvm:
64+
github.com/onflow/flow-go/fvm/environment:
65+
github.com/onflow/flow-go/fvm/storage/snapshot:
66+
github.com/onflow/flow-go/insecure:
67+
github.com/onflow/flow-go/ledger:
68+
github.com/onflow/flow-go/model/fingerprint:
69+
github.com/onflow/flow-go/module:
70+
github.com/onflow/flow-go/module/component:
71+
github.com/onflow/flow-go/module/execution:
72+
github.com/onflow/flow-go/module/executiondatasync/execution_data:
73+
github.com/onflow/flow-go/module/executiondatasync/optimistic_sync:
74+
config:
75+
all: False
76+
interfaces:
77+
Core:
78+
github.com/onflow/flow-go/module/executiondatasync/tracker:
79+
github.com/onflow/flow-go/module/forest:
80+
github.com/onflow/flow-go/module/mempool:
81+
github.com/onflow/flow-go/module/mempool/consensus/mock_interfaces:
82+
config:
83+
dir: "module/mempool/consensus/mock"
84+
github.com/onflow/flow-go/module/state_synchronization:
85+
github.com/onflow/flow-go/module/state_synchronization/requester:
86+
github.com/onflow/flow-go/network:
87+
github.com/onflow/flow-go/network/alsp:
88+
github.com/onflow/flow-go/network/p2p:
89+
github.com/onflow/flow-go/state/cluster:
90+
github.com/onflow/flow-go/state/protocol:
91+
github.com/onflow/flow-go/state/protocol/events:
92+
github.com/onflow/flow-go/state/protocol/protocol_state:
93+
github.com/onflow/flow-go/state/protocol/protocol_state/mock_interfaces:
94+
config:
95+
dir: "state/protocol/protocol_state/mock"
96+
github.com/onflow/flow-go/state/protocol/protocol_state/epochs:
97+
github.com/onflow/flow-go/state/protocol/protocol_state/epochs/mock_interfaces:
98+
config:
99+
dir: "state/protocol/protocol_state/epochs/mock"
100+
github.com/onflow/flow-go/storage:
101+
102+
# external libraries
103+
github.com/onflow/flow-go-sdk/access:
104+
config:
105+
dir: "integration/benchmark/mock"
106+
interfaces:
107+
Client:
108+
109+
github.com/onflow/crypto:
110+
config:
111+
dir: "module/mock"
112+
interfaces:
113+
PublicKey:

AGENTS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,21 @@ This file provides guidance to AI Agents when working with code in this reposito
5151
5252
### Code Quality and Generation
5353
- `make lint` - Run linter (includes tidy and custom checks)
54-
- `make lint -e LINT_PATH=./path/to/lint/...` - Run linter for a specific module
54+
- `make fix-new` - Run linter for files changed since master
5555
- `make fix-lint` - Automatically fix linting issues
56+
- `make fix-lint-new` - Automatically fix linting issues for files changed since master
57+
- `make fix-imports` - Automatically fix imports
58+
- `make fix-imports-new` - Automatically fix imports for files changed since master
59+
- `make vet` - Run go vet
60+
- `make vet-new` - Run go vet for files changed since master
5661
- `make generate` - Run all code generators (proto, mocks, fvm wrappers)
5762
- `make generate-mocks` - Generate mocks for unit tests
5863
- `make generate-proto` - Generate protobuf stubs
5964
- `make tidy` - Run go mod tidy
6065
66+
`lint`, `vet`, `fix-lint`, and `fix-imports` support passing `LINT_PATH`, which sets the path used by golangci-lint
67+
- `make lint -e LINT_PATH=./path/to/lint/...` - Run linter for a specific module
68+
6169
### Dependency Management
6270
- `make install-tools` - Install all required development tools
6371
- `make install-mock-generators` - Install mock generation tools

Makefile

Lines changed: 29 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ unittest-main:
7777
.PHONY: install-mock-generators
7878
install-mock-generators:
7979
cd ${GOPATH}; \
80-
go install github.com/vektra/mockery/[email protected]; \
81-
go install github.com/golang/mock/[email protected];
80+
go install github.com/vektra/mockery/[email protected];
8281

8382
.PHONY: install-tools
8483
install-tools: check-go-version install-mock-generators
@@ -154,83 +153,8 @@ generate-fvm-env-wrappers:
154153

155154
.PHONY: generate-mocks
156155
generate-mocks: install-mock-generators
157-
mockery --name '(Connector|PingInfoProvider)' --dir=network/p2p --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork"
158-
CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=network/mocknetwork/mock_network.go -package=mocknetwork github.com/onflow/flow-go/network EngineRegistry
159-
mockery --name=ExecutionDataStore --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock"
160-
mockery --name=Downloader --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock"
161-
mockery --name='.*' --dir=integration/benchmark/mocksiface --case=underscore --output="integration/benchmark/mock" --outpkg="mock"
162-
mockery --name '(ExecutionDataRequester|IndexReporter)' --dir=module/state_synchronization --case=underscore --output="./module/state_synchronization/mock" --outpkg="state_synchronization"
163-
mockery --name 'ExecutionState' --dir=engine/execution/state --case=underscore --output="engine/execution/state/mock" --outpkg="mock"
164-
mockery --name 'BlockComputer' --dir=engine/execution/computation/computer --case=underscore --output="engine/execution/computation/computer/mock" --outpkg="mock"
165-
mockery --name 'ComputationManager' --dir=engine/execution/computation --case=underscore --output="engine/execution/computation/mock" --outpkg="mock"
166-
mockery --name '.*' --dir=engine/execution/computation/query --case=underscore --output="engine/execution/computation/query/mock" --outpkg="mock"
167-
mockery --name 'EpochComponentsFactory' --dir=engine/collection/epochmgr --case=underscore --output="engine/collection/epochmgr/mock" --outpkg="mock"
168-
mockery --name '.*' --dir=engine/execution/ --case=underscore --output="engine/execution/mock" --outpkg="mock"
169-
mockery --name 'Backend' --dir=engine/collection/rpc --case=underscore --output="engine/collection/rpc/mock" --outpkg="mock"
170-
mockery --name 'ProviderEngine' --dir=engine/execution/provider --case=underscore --output="engine/execution/provider/mock" --outpkg="mock"
171-
mockery --name '.*' --dir=state/cluster --case=underscore --output="state/cluster/mock" --outpkg="mock"
172-
mockery --name '.*' --dir=module --case=underscore --output="./module/mock" --outpkg="mock"
173-
mockery --name '.*' --dir=module/mempool --case=underscore --output="./module/mempool/mock" --outpkg="mempool"
174-
mockery --name '.*' --dir=module/component --case=underscore --output="./module/component/mock" --outpkg="component"
175-
mockery --name '.*' --dir=network --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork"
176-
mockery --name '.*' --dir=storage --case=underscore --output="./storage/mock" --outpkg="mock"
177-
mockery --name '.*' --dir="state/protocol" --case=underscore --output="state/protocol/mock" --outpkg="mock"
178-
mockery --name '.*' --dir="state/protocol/events" --case=underscore --output="./state/protocol/events/mock" --outpkg="mock"
179-
mockery --name '.*' --dir="state/protocol/protocol_state" --case=underscore --output="state/protocol/protocol_state/mock" --outpkg="mock"
180-
mockery --name '.*' --dir="state/protocol/protocol_state/epochs" --case=underscore --output="state/protocol/protocol_state/epochs/mock" --outpkg="mock"
181-
mockery --name '.*' --dir=engine/execution/computation/computer --case=underscore --output="./engine/execution/computation/computer/mock" --outpkg="mock"
182-
mockery --name '.*' --dir=engine/execution/state --case=underscore --output="./engine/execution/state/mock" --outpkg="mock"
183-
mockery --name '.*' --dir=engine/collection --case=underscore --output="./engine/collection/mock" --outpkg="mock"
184-
mockery --name 'complianceCore' --dir=engine/common/follower --exported --case=underscore --output="./engine/common/follower/mock" --outpkg="mock"
185-
mockery --name '.*' --dir=engine/common/follower/cache --case=underscore --output="./engine/common/follower/cache/mock" --outpkg="mock"
186-
mockery --name '.*' --dir=engine/consensus --case=underscore --output="./engine/consensus/mock" --outpkg="mock"
187-
mockery --name '.*' --dir=engine/consensus/approvals --case=underscore --output="./engine/consensus/approvals/mock" --outpkg="mock"
188-
rm -rf ./fvm/mock
189-
mockery --name '.*' --dir=fvm --case=underscore --output="./fvm/mock" --outpkg="mock"
190-
rm -rf ./fvm/environment/mock
191-
mockery --name '.*' --dir=fvm/environment --case=underscore --output="./fvm/environment/mock" --outpkg="mock"
192-
mockery --name '.*' --dir=ledger --case=underscore --output="./ledger/mock" --outpkg="mock"
193-
mockery --name 'ViolationsConsumer' --dir=network --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork"
194-
mockery --name '.*' --dir=network/p2p/ --case=underscore --output="./network/p2p/mock" --outpkg="mockp2p"
195-
mockery --name '.*' --dir=network/alsp --case=underscore --output="./network/alsp/mock" --outpkg="mockalsp"
196-
mockery --name 'Vertex' --dir="./module/forest" --case=underscore --output="./module/forest/mock" --outpkg="mock"
197-
mockery --name '.*' --dir="./consensus/hotstuff" --case=underscore --output="./consensus/hotstuff/mocks" --outpkg="mocks"
198-
mockery --name '.*' --dir="./engine/access/wrapper" --case=underscore --output="./engine/access/mock" --outpkg="mock"
199-
mockery --name 'API' --dir="./access" --case=underscore --output="./access/mock" --outpkg="mock"
200-
mockery --name 'Blocks' --dir="./access/validator" --case=underscore --output="./access/validator/mock" --outpkg="mock"
201-
mockery --name 'API' --dir="./engine/protocol" --case=underscore --output="./engine/protocol/mock" --outpkg="mock"
202-
mockery --name '.*' --dir="./engine/access/state_stream" --case=underscore --output="./engine/access/state_stream/mock" --outpkg="mock"
203-
mockery --name 'BlockTracker' --dir="./engine/access/subscription/tracker" --case=underscore --output="./engine/access/subscription/tracker/mock" --outpkg="mock"
204-
mockery --name 'ExecutionDataTracker' --dir="./engine/access/subscription/tracker" --case=underscore --output="./engine/access/subscription/tracker/mock" --outpkg="mock"
205-
mockery --name 'DataProvider' --dir="./engine/access/rest/websockets/data_providers" --case=underscore --output="./engine/access/rest/websockets/data_providers/mock" --outpkg="mock"
206-
mockery --name 'DataProviderFactory' --dir="./engine/access/rest/websockets/data_providers" --case=underscore --output="./engine/access/rest/websockets/data_providers/mock" --outpkg="mock"
207-
mockery --name 'LinkGenerator' --dir="./engine/access/rest/common/models" --case=underscore --output="./engine/access/rest/common/models/mock" --outpkg="mock"
208-
mockery --name 'WebsocketConnection' --dir="./engine/access/rest/websockets" --case=underscore --output="./engine/access/rest/websockets/mock" --outpkg="mock"
209-
mockery --name 'ConnectionFactory' --dir="./engine/access/rpc/connection" --case=underscore --output="./engine/access/rpc/connection/mock" --outpkg="mock"
210-
mockery --name 'Communicator' --dir="./engine/access/rpc/backend/node_communicator" --case=underscore --output="./engine/access/rpc/backend/node_communicator/mock" --outpkg="mock"
211-
mockery --name 'AccountProvider' --dir="./engine/access/rpc/backend/accounts/provider" --case=underscore --output="./engine/access/rpc/backend/accounts/provider/mock" --outpkg="mock"
212-
mockery --name 'EventProvider' --dir="./engine/access/rpc/backend/events/provider" --case=underscore --output="./engine/access/rpc/backend/events/provider/mock" --outpkg="mock"
213-
mockery --name 'TransactionProvider' --dir="./engine/access/rpc/backend/transactions/provider" --case=underscore --output="./engine/access/rpc/backend/transactions/provider/mock" --outpkg="mock"
214-
mockery --name 'Provider' --dir="./engine/access/rpc/backend/transactions/error_messages" --case=underscore --output="./engine/access/rpc/backend/transactions/error_messages/mock" --outpkg="mock"
215-
mockery --name 'TransactionSender' --dir="./engine/access/rpc/backend/transactions/retrier" --case=underscore --output="./engine/access/rpc/backend/transactions/retrier/mock" --outpkg="mock"
216-
mockery --name 'Retrier' --dir="./engine/access/rpc/backend/transactions/retrier" --case=underscore --output="./engine/access/rpc/backend/transactions/retrier/mock" --outpkg="mock"
217-
mockery --name '.*' --dir=model/fingerprint --case=underscore --output="./model/fingerprint/mock" --outpkg="mock"
218-
mockery --name 'ExecForkActor' --structname 'ExecForkActorMock' --dir=module/mempool/consensus/mock/ --case=underscore --output="./module/mempool/consensus/mock/" --outpkg="mock"
219-
mockery --name '.*' --dir=engine/verification/fetcher/ --case=underscore --output="./engine/verification/fetcher/mock" --outpkg="mockfetcher"
220-
mockery --name '.*' --dir=./cmd/util/ledger/reporters --case=underscore --output="./cmd/util/ledger/reporters/mock" --outpkg="mock"
221-
mockery --name 'Storage' --dir=module/executiondatasync/tracker --case=underscore --output="module/executiondatasync/tracker/mock" --outpkg="mocktracker"
222-
mockery --name 'ScriptExecutor' --dir=module/execution --case=underscore --output="module/execution/mock" --outpkg="mock"
223-
mockery --name 'StorageSnapshot' --dir=fvm/storage/snapshot --case=underscore --output="fvm/storage/snapshot/mock" --outpkg="mock"
224-
mockery --name 'Core' --dir=module/executiondatasync/optimistic_sync --case=underscore --output="module/executiondatasync/optimistic_sync/mock" --outpkg="mock"
225-
mockery --name 'Requester' --dir=engine/access/ingestion/tx_error_messages --case=underscore --output="engine/access/ingestion/tx_error_messages/mock" --outpkg="mock"
226-
mockery --name 'ExecutionDataRequester' --dir=module/state_synchronization/requester --case=underscore --output="module/state_synchronization/requester/mock" --outpkg="mock"
227-
228-
#temporarily make insecure/ a non-module to allow mockery to create mocks
229-
mv insecure/go.mod insecure/go2.mod
230-
if [ -f go.work ]; then mv go.work go2.work; fi
231-
mockery --name '.*' --dir=insecure/ --case=underscore --output="./insecure/mock" --outpkg="mockinsecure"
232-
mv insecure/go2.mod insecure/go.mod
233-
if [ -f go2.work ]; then mv go2.work go.work; fi
156+
mockery --config .mockery.yaml
157+
cd insecure; mockery --config .mockery.yaml
234158

235159
# this ensures there is no unused dependency being added by accident
236160
.PHONY: tidy
@@ -246,15 +170,39 @@ tools/custom-gcl: tools/structwrite .custom-gcl.yml
246170
golangci-lint custom
247171

248172
.PHONY: lint
249-
lint: tidy tools/custom-gcl
173+
lint: tools/custom-gcl
250174
# revive -config revive.toml -exclude storage/ledger/trie ./...
251175
./tools/custom-gcl run -v $(or $(LINT_PATH),./...)
252176

177+
.PHONY: lint-new
178+
lint-new: tools/custom-gcl
179+
./tools/custom-gcl run -v --new-from-rev=master
180+
253181
.PHONY: fix-lint
254-
fix-lint:
182+
fix-lint: tools/custom-gcl
255183
# revive -config revive.toml -exclude storage/ledger/trie ./...
256184
./tools/custom-gcl run -v --fix $(or $(LINT_PATH),./...)
257185

186+
.PHONY: fix-lint-new
187+
fix-lint-new: tools/custom-gcl
188+
./tools/custom-gcl run -v --fix --new-from-rev=master
189+
190+
.PHONY: fix-imports
191+
fix-imports: tools/custom-gcl
192+
./tools/custom-gcl run --enable-only=gci --fix $(or $(LINT_PATH),./...)
193+
194+
.PHONY: fix-imports-new
195+
fix-imports-new: tools/custom-gcl
196+
./tools/custom-gcl run --enable-only=gci --fix --new-from-rev=master
197+
198+
.PHONY: vet
199+
vet: tools/custom-gcl
200+
./tools/custom-gcl run --enable-only=govet $(or $(LINT_PATH),./...)
201+
202+
.PHONY: vet-new
203+
vet-new: tools/custom-gcl
204+
./tools/custom-gcl run --enable-only=govet --new-from-rev=master
205+
258206
# Runs unit tests with different list of packages as passed by CI so they run in parallel
259207
.PHONY: ci
260208
ci: install-tools test

0 commit comments

Comments
 (0)