Skip to content

Commit a9d27b4

Browse files
committed
Merge branch 'master' of https://github.com/onflow/flow-go into yurii/sync-master-to-dynamic-protocol-state
2 parents e210519 + e4011e4 commit a9d27b4

File tree

348 files changed

+17600
-4359
lines changed

Some content is hidden

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

348 files changed

+17600
-4359
lines changed

.github/workflows/ci.yml

Lines changed: 113 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
cache: true
100100
- name: Set Test Matrix
101101
id: set-test-matrix
102-
run: go run utils/test_matrix/test_matrix.go admin cmd consensus engine fvm ledger module network/test network/p2p utils
102+
run: go run utils/test_matrix/test_matrix.go admin cmd consensus engine/access engine/collection engine/common engine/consensus engine/execution/ingestion:buildjet-8vcpu-ubuntu-2204 engine/execution/computation engine/execution engine/verification engine:buildjet-4vcpu-ubuntu-2204 fvm ledger module/dkg module:buildjet-4vcpu-ubuntu-2204 network/alsp network/test/cohort1:buildjet-16vcpu-ubuntu-2204 network/test/cohort2:buildjet-4vcpu-ubuntu-2204 network/p2p/connection network/p2p/p2pnode:buildjet-4vcpu-ubuntu-2204 network/p2p/scoring network/p2p network state storage utils
103103

104104
unit-test:
105105
name: Unit Tests (${{ matrix.targets.name }})
@@ -108,8 +108,8 @@ jobs:
108108
fail-fast: false
109109
matrix:
110110
targets: ${{ fromJSON(needs.create-dynamic-test-matrix.outputs.dynamic-matrix)}}
111-
# need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202
112-
runs-on: ubuntu-20.04
111+
## need to set image explicitly due to GitHub logging issue as described in https://github.com/onflow/flow-go/pull/3087#issuecomment-1234383202
112+
runs-on: ${{ matrix.targets.runner }}
113113
steps:
114114
- name: Checkout repo
115115
uses: actions/checkout@v3
@@ -123,8 +123,8 @@ jobs:
123123
- name: Run tests (${{ matrix.targets.name }})
124124
uses: nick-fields/retry@v2
125125
with:
126-
timeout_minutes: 25
127-
max_attempts: 3
126+
timeout_minutes: 35
127+
max_attempts: 5
128128
command: VERBOSE=1 make -e GO_TEST_PACKAGES="${{ matrix.targets.packages }}" test
129129

130130
# TODO(rbtz): re-enable when we fix exisiting races.
@@ -148,17 +148,20 @@ jobs:
148148
make2: unittest
149149
retries: 1
150150
race: 1
151+
runner: ubuntu-latest
151152
- name: insecure
152153
make1: install-tools
153154
make2: test
154-
retries: 3
155+
retries: 5
155156
race: 0
157+
runner: buildjet-4vcpu-ubuntu-2204
156158
- name: integration
157159
make1: install-tools
158160
make2: test
159-
retries: 3
161+
retries: 5
160162
race: 0
161-
runs-on: ubuntu-latest
163+
runner: buildjet-4vcpu-ubuntu-2204
164+
runs-on: ${{ matrix.runner }}
162165
steps:
163166
- name: Checkout repo
164167
uses: actions/checkout@v3
@@ -174,7 +177,7 @@ jobs:
174177
RACE_DETECTOR: ${{ matrix.race }}
175178
uses: nick-fields/retry@v2
176179
with:
177-
timeout_minutes: 25
180+
timeout_minutes: 35
178181
max_attempts: ${{ matrix.retries }}
179182
# run `make2` target inside each module's root
180183
command: VERBOSE=1 make -C ${{ matrix.name }} ${{ matrix.make2 }}
@@ -185,27 +188,101 @@ jobs:
185188
flags: unittests
186189
name: codecov-umbrella
187190

191+
docker-build:
192+
name: Docker Build
193+
runs-on: buildjet-16vcpu-ubuntu-2204
194+
steps:
195+
- name: Checkout repo
196+
uses: actions/checkout@v3
197+
with:
198+
# all tags are needed for integration tests
199+
fetch-depth: 0
200+
- name: Setup Go
201+
uses: actions/setup-go@v3
202+
with:
203+
go-version: ${{ env.GO_VERSION }}
204+
cache: true
205+
- name: Build relic
206+
run: make crypto_setup_gopath
207+
- name: Docker build
208+
run: make docker-build-flow docker-build-flow-corrupt
209+
- name: Save Docker images
210+
run: |
211+
docker save \
212+
gcr.io/flow-container-registry/access:latest \
213+
gcr.io/flow-container-registry/collection:latest \
214+
gcr.io/flow-container-registry/consensus:latest \
215+
gcr.io/flow-container-registry/execution:latest \
216+
gcr.io/flow-container-registry/ghost:latest \
217+
gcr.io/flow-container-registry/observer:latest \
218+
gcr.io/flow-container-registry/verification:latest \
219+
gcr.io/flow-container-registry/access-corrupted:latest \
220+
gcr.io/flow-container-registry/execution-corrupted:latest \
221+
gcr.io/flow-container-registry/verification-corrupted:latest > flow-docker-images.tar
222+
- name: Cache Docker images
223+
uses: actions/cache@v3
224+
with:
225+
path: flow-docker-images.tar
226+
# use the workflow run id as part of the cache key to ensure these docker images will only be used for a single workflow run
227+
key: flow-docker-images-${{ hashFiles('**/Dockerfile') }}-${{ github.run_id }}
228+
188229
integration-test:
189230
name: Integration Tests
231+
needs: docker-build
190232
strategy:
191233
fail-fast: false
192234
matrix:
193-
make:
194-
- make -C integration access-tests
195-
- make -C integration bft-framework-tests
196-
- make -C integration bft-protocol-tests
197-
- make -C integration bft-gossipsub-tests
198-
- make -C integration collection-tests
199-
- make -C integration consensus-tests
200-
- make -C integration epochs-cohort1-tests
201-
- make -C integration epochs-cohort2-tests
202-
- make -C integration execution-tests
203-
- make -C integration ghost-tests
204-
- make -C integration mvp-tests
205-
- make -C integration network-tests
206-
- make -C integration verification-tests
207-
- make -C integration upgrades-tests
208-
runs-on: ubuntu-latest
235+
include:
236+
- name: Access Cohort1 Integration Tests
237+
make: make -C integration access-cohort1-tests
238+
runner: buildjet-4vcpu-ubuntu-2204
239+
- name: Access Cohort2 Integration Tests
240+
make: make -C integration access-cohort2-tests
241+
runner: ubuntu-latest
242+
- name: Access Cohort3 Integration Tests
243+
make: make -C integration access-cohort3-tests
244+
runner: ubuntu-latest
245+
# test suite has single test which is flaky and needs to be fixed - reminder here to put it back when it's fixed
246+
# - name: BFT (Framework) Integration Tests
247+
# make: make -C integration bft-framework-tests
248+
# runner: ubuntu-latest
249+
- name: BFT (Protocol) Integration Tests
250+
make: make -C integration bft-protocol-tests
251+
runner: buildjet-8vcpu-ubuntu-2204
252+
- name: BFT (Gossipsub) Integration Tests
253+
make: make -C integration bft-gossipsub-tests
254+
runner: ubuntu-latest
255+
- name: Collection Integration Tests
256+
make: make -C integration collection-tests
257+
runner: ubuntu-latest
258+
- name: Consensus Integration Tests
259+
make: make -C integration consensus-tests
260+
runner: ubuntu-latest
261+
- name: Epoch Cohort1 Integration Tests
262+
make: make -C integration epochs-cohort1-tests
263+
runner: buildjet-8vcpu-ubuntu-2204
264+
- name: Epoch Cohort2 Integration Tests
265+
make: make -C integration epochs-cohort2-tests
266+
runner: buildjet-4vcpu-ubuntu-2204
267+
- name: Execution Integration Tests
268+
make: make -C integration execution-tests
269+
runner: ubuntu-latest
270+
- name: Ghost Integration Tests
271+
make: make -C integration ghost-tests
272+
runner: ubuntu-latest
273+
- name: MVP Integration Tests
274+
make: make -C integration mvp-tests
275+
runner: ubuntu-latest
276+
- name: Network Integration Tests
277+
make: make -C integration network-tests
278+
runner: ubuntu-latest
279+
- name: Verification Integration Tests
280+
make: make -C integration verification-tests
281+
runner: ubuntu-latest
282+
- name: Upgrade Integration Tests
283+
make: make -C integration upgrades-tests
284+
runner: ubuntu-latest
285+
runs-on: ${{ matrix.runner }}
209286
steps:
210287
- name: Checkout repo
211288
uses: actions/checkout@v3
@@ -219,51 +296,20 @@ jobs:
219296
cache: true
220297
- name: Build relic
221298
run: make crypto_setup_gopath
222-
- name: Docker build
223-
run: make docker-build-flow docker-build-flow-corrupt
224-
- name: Run tests
299+
- name: Load cached Docker images
300+
uses: actions/cache@v3
301+
with:
302+
path: flow-docker-images.tar
303+
# use the same cache key as the docker-build job
304+
key: flow-docker-images-${{ hashFiles('**/Dockerfile') }}-${{ github.run_id }}
305+
- name: Load Docker images
306+
run: docker load -i flow-docker-images.tar
307+
- name: Run tests (${{ matrix.name }})
225308
# TODO(rbtz): re-enable when we fix exisiting races.
226309
#env:
227310
# RACE_DETECTOR: 1
228311
uses: nick-fields/retry@v2
229312
with:
230-
timeout_minutes: 25
231-
max_attempts: 3
313+
timeout_minutes: 35
314+
max_attempts: 5
232315
command: VERBOSE=1 ${{ matrix.make }}
233-
234-
localnet-test:
235-
name: Localnet Compatibility Tests With Flow-CLI Client and Observer
236-
strategy:
237-
fail-fast: false
238-
runs-on: ubuntu-latest
239-
steps:
240-
- name: Checkout repo
241-
uses: actions/checkout@v3
242-
- name: Setup Go
243-
uses: actions/setup-go@v3
244-
with:
245-
go-version: ${{ env.GO_VERSION }}
246-
cache: true
247-
- name: Build relic and other tools
248-
run: make install-tools
249-
- name: Install Flow Client In Docker
250-
# This proved to be more reliable than installing it locally.
251-
run: cd integration/localnet && sh client/client.sh
252-
- name: Set up Localnet
253-
run: bash -c 'cd integration/localnet/ && make -e OBSERVER=2 bootstrap && make start-flow'
254-
- name: Ensure Observer is started
255-
run: docker ps -f name=localnet-observer_1-1 | grep localnet-observer
256-
- name: Get Client Version ensuring the client is provisioned
257-
run: docker run --network host localnet-client /go/flow -f /go/flow-localnet.json -n observer version
258-
- name: Wait for a default waiting period until a clean state
259-
# This will not cause flakiness.
260-
# The waiting time is a reasonable time to expect an observer to be responsive
261-
run: sleep 10
262-
- name: Get Status ensuring the access endpoint is online
263-
run: docker run --network host localnet-client /go/flow -f /go/flow-localnet.json -n access status
264-
- name: Wait for finalized blocks and check them
265-
run: docker run --network host localnet-client /go/flow -f /go/flow-localnet.json -n observer blocks get latest
266-
- name: Wait for finalized blocks and check them with Observer
267-
run: sleep 5 && docker run --network host localnet-client /go/flow -f /go/flow-localnet.json -n access blocks get latest && docker run --network host localnet-client /go/flow -f /go/flow-localnet.json -n observer blocks get latest
268-
- name: Stop localnet
269-
run: bash -c 'cd integration/localnet/ && make stop'

.github/workflows/flaky-test-monitor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
push:
99
paths:
1010
- '.github/workflows/flaky-test-monitor.yml'
11-
- '.github/workflows/ci.yml'
1211

1312
env:
1413
BIGQUERY_DATASET: production_src_flow_test_metrics

.github/workflows/tools.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ jobs:
3333
with:
3434
go-version: "1.20"
3535
- name: Checkout repo
36-
uses: actions/checkout@v2
36+
uses: actions/checkout@v3
3737
with:
38+
# to accurately get the version tag
39+
fetch-depth: 0
3840
ref: ${{ inputs.tag }}
3941
- name: Build relic
4042
run: make crypto_setup_gopath

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ cmd/util/util:
5252

5353
.PHONY: update-core-contracts-version
5454
update-core-contracts-version:
55+
# updates the core-contracts version in all of the go.mod files
56+
# usage example: CC_VERSION=0.16.0 make update-core-contracts-version
5557
./scripts/update-core-contracts.sh $(CC_VERSION)
58+
make tidy
59+
60+
.PHONY: update-cadence-version
61+
update-cadence-version:
62+
# updates the cadence version in all of the go.mod files
63+
# usage example: CC_VERSION=0.16.0 make update-cadence-version
64+
./scripts/update-cadence.sh $(CC_VERSION)
65+
make tidy
5666

5767
############################################################################################
5868
# CAUTION: DO NOT MODIFY THESE TARGETS! DOING SO WILL BREAK THE FLAKY TEST MONITOR
@@ -162,6 +172,7 @@ generate-mocks: install-mock-generators
162172
mockery --name 'ComputationManager' --dir=engine/execution/computation --case=underscore --output="engine/execution/computation/mock" --outpkg="mock"
163173
mockery --name '.*' --dir=engine/execution/computation/query --case=underscore --output="engine/execution/computation/query/mock" --outpkg="mock"
164174
mockery --name 'EpochComponentsFactory' --dir=engine/collection/epochmgr --case=underscore --output="engine/collection/epochmgr/mock" --outpkg="mock"
175+
mockery --name '.*' --dir=engine/execution/ --case=underscore --output="engine/execution/mock" --outpkg="mock"
165176
mockery --name 'Backend' --dir=engine/collection/rpc --case=underscore --output="engine/collection/rpc/mock" --outpkg="mock"
166177
mockery --name 'ProviderEngine' --dir=engine/execution/provider --case=underscore --output="engine/execution/provider/mock" --outpkg="mock"
167178
(cd ./crypto && mockery --name 'PublicKey' --case=underscore --output="../module/mock" --outpkg="mock")
@@ -202,6 +213,7 @@ generate-mocks: install-mock-generators
202213
mockery --name '.*' --dir=engine/verification/fetcher/ --case=underscore --output="./engine/verification/fetcher/mock" --outpkg="mockfetcher"
203214
mockery --name '.*' --dir=./cmd/util/ledger/reporters --case=underscore --output="./cmd/util/ledger/reporters/mock" --outpkg="mock"
204215
mockery --name 'Storage' --dir=module/executiondatasync/tracker --case=underscore --output="module/executiondatasync/tracker/mock" --outpkg="mocktracker"
216+
mockery --name 'ScriptExecutor' --dir=module/execution --case=underscore --output="module/execution/mock" --outpkg="mock"
205217

206218
#temporarily make insecure/ a non-module to allow mockery to create mocks
207219
mv insecure/go.mod insecure/go2.mod
@@ -420,7 +432,7 @@ docker-build-ghost-debug:
420432

421433
PHONY: docker-build-bootstrap
422434
docker-build-bootstrap:
423-
docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/bootstrap --build-arg GOARCH=$(GOARCH) --target production \
435+
docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/bootstrap --build-arg GOARCH=$(GOARCH) --build-arg VERSION=$(IMAGE_TAG) --target production \
424436
--label "git_commit=${COMMIT}" --label "git_tag=${IMAGE_TAG}" \
425437
-t "$(CONTAINER_REGISTRY)/bootstrap:latest" -t "$(CONTAINER_REGISTRY)/bootstrap:$(SHORT_COMMIT)" -t "$(CONTAINER_REGISTRY)/bootstrap:$(IMAGE_TAG)" .
426438

@@ -620,7 +632,7 @@ docker-all-tools: tool-util tool-remove-execution-fork
620632

621633
PHONY: docker-build-util
622634
docker-build-util:
623-
docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/util --build-arg GOARCH=$(GOARCH) --target production \
635+
docker build -f cmd/Dockerfile --build-arg TARGET=./cmd/util --build-arg GOARCH=$(GOARCH) --build-arg VERSION=$(IMAGE_TAG) --target production \
624636
-t "$(CONTAINER_REGISTRY)/util:latest" -t "$(CONTAINER_REGISTRY)/util:$(SHORT_COMMIT)" -t "$(CONTAINER_REGISTRY)/util:$(IMAGE_TAG)" .
625637

626638
PHONY: tool-util
@@ -629,7 +641,7 @@ tool-util: docker-build-util
629641

630642
PHONY: docker-build-remove-execution-fork
631643
docker-build-remove-execution-fork:
632-
docker build -f cmd/Dockerfile --ssh default --build-arg TARGET=./cmd/util/cmd/remove-execution-fork --build-arg GOARCH=$(GOARCH) --target production \
644+
docker build -f cmd/Dockerfile --ssh default --build-arg TARGET=./cmd/util/cmd/remove-execution-fork --build-arg GOARCH=$(GOARCH) --build-arg VERSION=$(IMAGE_TAG) --target production \
633645
-t "$(CONTAINER_REGISTRY)/remove-execution-fork:latest" -t "$(CONTAINER_REGISTRY)/remove-execution-fork:$(SHORT_COMMIT)" -t "$(CONTAINER_REGISTRY)/remove-execution-fork:$(IMAGE_TAG)" .
634646

635647
PHONY: tool-remove-execution-fork

access/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ type API interface {
2929
SendTransaction(ctx context.Context, tx *flow.TransactionBody) error
3030
GetTransaction(ctx context.Context, id flow.Identifier) (*flow.TransactionBody, error)
3131
GetTransactionsByBlockID(ctx context.Context, blockID flow.Identifier) ([]*flow.TransactionBody, error)
32-
GetTransactionResult(ctx context.Context, id flow.Identifier, blockID flow.Identifier, collectionID flow.Identifier) (*TransactionResult, error)
33-
GetTransactionResultByIndex(ctx context.Context, blockID flow.Identifier, index uint32) (*TransactionResult, error)
34-
GetTransactionResultsByBlockID(ctx context.Context, blockID flow.Identifier) ([]*TransactionResult, error)
32+
GetTransactionResult(ctx context.Context, id flow.Identifier, blockID flow.Identifier, collectionID flow.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion) (*TransactionResult, error)
33+
GetTransactionResultByIndex(ctx context.Context, blockID flow.Identifier, index uint32, requiredEventEncodingVersion entities.EventEncodingVersion) (*TransactionResult, error)
34+
GetTransactionResultsByBlockID(ctx context.Context, blockID flow.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion) ([]*TransactionResult, error)
3535

3636
GetAccount(ctx context.Context, address flow.Address) (*flow.Account, error)
3737
GetAccountAtLatestBlock(ctx context.Context, address flow.Address) (*flow.Account, error)
@@ -41,8 +41,8 @@ type API interface {
4141
ExecuteScriptAtBlockHeight(ctx context.Context, blockHeight uint64, script []byte, arguments [][]byte) ([]byte, error)
4242
ExecuteScriptAtBlockID(ctx context.Context, blockID flow.Identifier, script []byte, arguments [][]byte) ([]byte, error)
4343

44-
GetEventsForHeightRange(ctx context.Context, eventType string, startHeight, endHeight uint64) ([]flow.BlockEvents, error)
45-
GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []flow.Identifier) ([]flow.BlockEvents, error)
44+
GetEventsForHeightRange(ctx context.Context, eventType string, startHeight, endHeight uint64, requiredEventEncodingVersion entities.EventEncodingVersion) ([]flow.BlockEvents, error)
45+
GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []flow.Identifier, requiredEventEncodingVersion entities.EventEncodingVersion) ([]flow.BlockEvents, error)
4646

4747
GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error)
4848

0 commit comments

Comments
 (0)