Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.26.3 merge master #2541

Merged
merged 270 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
270 commits
Select commit Hold shift + click to select a range
877a35a
always cache new execution datas
peterargue Feb 22, 2022
4d1643c
throw irrecoverable on invalid blobs
peterargue Feb 24, 2022
a6f7dd4
cleanup comments and logging
peterargue Mar 9, 2022
6dc4124
merge notifications and cache and refactor into heap
peterargue Mar 9, 2022
95b4de2
add config, add restart handling, code cleanup
peterargue Mar 10, 2022
650d737
improve error handling, cleanup refactoring
peterargue Mar 11, 2022
11caa60
cleanup error handling, refactor status
peterargue Mar 11, 2022
b956071
fix unittest import cycle, and some cleanup
peterargue Mar 11, 2022
55de132
make more options configurable
peterargue Mar 11, 2022
b505890
cleanup comments and naming
peterargue Mar 11, 2022
6eed3d6
add metrics
peterargue Mar 12, 2022
b267387
remove metrics comment
peterargue Mar 12, 2022
606a209
add tests and fix bugs for status module
peterargue Mar 13, 2022
049f88b
fix bug in status duplicate height processing
peterargue Mar 14, 2022
d328240
fix scoping in edr setup
peterargue Mar 14, 2022
3754779
use a single implementation of blob_service
peterargue Mar 14, 2022
9981054
add testing for RestartableComponent
peterargue Mar 17, 2022
9a4c5dc
add more comments and unittests
peterargue Mar 24, 2022
bef24cf
update check function prototype
peterargue Mar 31, 2022
7c02970
convert to use jobqueue
peterargue Apr 6, 2022
a909117
fix rebase conflict
peterargue Apr 6, 2022
b98c0ff
Update module/state_synchronization/requester/execution_data_requeste…
peterargue Apr 6, 2022
09c181c
add unit tests for notification_heap
peterargue Apr 6, 2022
3c2e941
Move ExecutionDataRequester interface to state_synchronization package
peterargue Apr 6, 2022
67d170d
improve requester comments
peterargue Apr 6, 2022
a455460
cleanup requester bootstrapping
peterargue Apr 6, 2022
d408c7b
add tests for ExecutionDataService
peterargue Apr 7, 2022
dfdef70
remove unused consumer member, rename wrapped structs to readydoneaware
peterargue Apr 13, 2022
bbeda77
add unittest for starting from halted state
peterargue Apr 13, 2022
5fd903b
Update module/state_synchronization/requester/execution_data_requeste…
peterargue Apr 13, 2022
56c10a8
Update module/state_synchronization/requester/execution_data_requeste…
peterargue Apr 13, 2022
e1777e4
switch to storage.headers
peterargue Apr 13, 2022
38ac403
save halted reason, improve logging
peterargue Apr 13, 2022
932d14c
move pause/resume to jobqueue
peterargue Apr 14, 2022
10372b6
Remove min heap from status
peterargue Apr 20, 2022
bc81ac9
add unittest for ReadyDoneAwareConsumer
peterargue Apr 21, 2022
da50219
remove halts, switch to stateless notification status
peterargue Apr 22, 2022
292b9bf
refactor datastore check into separate struct, add unit tests
peterargue Apr 26, 2022
ac6ef4b
Apply suggestions from code review
peterargue Apr 26, 2022
f963f6f
remove halted metric
peterargue Apr 27, 2022
acf214b
refactor start block to be more explicit
peterargue Apr 28, 2022
c5e4295
move finalized block reader and sealed header reader to jobqueue name…
peterargue Apr 28, 2022
b1c06c9
reorder consumer args, add pre/post notifiers
peterargue Apr 28, 2022
f7d6db5
remove execution data cache, move ed get into reader
peterargue Apr 28, 2022
e496742
fix sealed reader test, improve comments
peterargue Apr 28, 2022
78f46cb
fix datastore check tests and components lifecycle
peterargue Apr 28, 2022
69d2bfb
rename ReadyDoneAwareConsumer to ComponentConsumer
peterargue Apr 28, 2022
e1e7b9e
fix linting issues
peterargue Apr 29, 2022
fb2f96a
increase timeouts in check datastore tests
peterargue Apr 29, 2022
25755eb
comment improvements from review
peterargue May 1, 2022
fe8fe50
remove datastore checker
peterargue May 1, 2022
95ae08c
remove now used execution data service check method
peterargue May 2, 2022
94a5f6c
add more details to execution data service get comments
peterargue May 2, 2022
60ebe88
fix tests after rebase
peterargue May 2, 2022
45456ad
fix lint errors
peterargue May 2, 2022
350600f
cleanup unused arguments
peterargue May 2, 2022
09efed9
apply comment update from review
peterargue May 3, 2022
d7446bb
add requester integration test
peterargue May 4, 2022
74cff5b
add missing lock in module/jobqueue/consumer.go
peterargue May 4, 2022
646890f
add lock to jobqueue consumer size()
peterargue May 4, 2022
1743993
remove changes to blob service, and create new test blobservice for l…
peterargue May 4, 2022
79f6ebd
fix potential hang in consumer startup, update cli arg description
peterargue May 9, 2022
5b05cd8
update storage namespaces in access_node_builder
peterargue May 10, 2022
90198d9
Apply suggestions from code review
zhangchiqing May 10, 2022
1ab8088
Apply suggestions from code review
zhangchiqing May 10, 2022
eb88756
Apply suggestions from code review
zhangchiqing May 10, 2022
0ecaae3
Apply suggestions from code review
zhangchiqing May 10, 2022
e067edd
update pull vs push
zhangchiqing May 10, 2022
a0323a6
Update module/component/component.go
synzhu May 12, 2022
65bfe52
temp
danielholmes839 May 16, 2022
f333279
switched to component manager / queues and workers
danielholmes839 May 17, 2022
ae47342
comments
danielholmes839 May 17, 2022
87ef6be
removed 'wait for engine to be done processing' assertions
danielholmes839 May 17, 2022
f0bdc2e
go fmt
danielholmes839 May 17, 2022
e15ba5e
go fmt, comments
danielholmes839 May 17, 2022
ac0ba57
switched to one message handler
danielholmes839 May 18, 2022
45910e5
removed queue metrics, updated queue capacity
danielholmes839 May 18, 2022
f45ae84
temporary fix to unit tests
danielholmes839 May 18, 2022
00a1052
undo removing requestMissingCollections
danielholmes839 May 18, 2022
3c25647
temp
danielholmes839 May 18, 2022
23cc1fa
check pipeline
danielholmes839 May 18, 2022
35ae5b3
Remove unused codeowners
sideninja May 19, 2022
1b3127c
option #1 flag
danielholmes839 May 19, 2022
09a4897
trying to fix access_test.go
danielholmes839 May 19, 2022
944b871
trying to fix access_test.go
danielholmes839 May 19, 2022
cdea6a5
trying to fix access_test.go
danielholmes839 May 19, 2022
456a542
trying to fix access_test.go
danielholmes839 May 19, 2022
31d5667
trying to fix access_test.go
danielholmes839 May 19, 2022
c65604b
it's working locallygit add *.go!
danielholmes839 May 19, 2022
bf0b491
Merge branch 'master' into sideninja/codeowners-patch
tarakby May 20, 2022
0165ebc
Merge branch 'master' into sideninja/codeowners-patch
zhangchiqing May 20, 2022
9525322
Add atree reporter to execution state extraction
fxamacker May 20, 2022
1cb281c
Fix lint error
fxamacker May 20, 2022
42464d9
switch 'IsTest' to 'DisableProcessBackground', and component shutdown…
danielholmes839 May 20, 2022
0e7ca61
fix linting error
danielholmes839 May 20, 2022
dc90e33
validate guarantors
zhangchiqing May 20, 2022
dd6ab50
handle error from FindGuarantors
zhangchiqing May 20, 2022
ab46d59
add comment
zhangchiqing May 20, 2022
098777d
add go workspace files to .dockerignore and .gitignore
SaveTheRbtz May 23, 2022
85464cc
Add Ledger.GetSingleValue for speedups and memory
fxamacker May 24, 2022
729e26f
Update ledger mock
fxamacker May 24, 2022
cb8a1a3
Merge branch 'master' into fxamacker/optimize-reading-single-register
fxamacker May 24, 2022
d9a57fa
Check Mtrie root integrity after read in tests
fxamacker May 24, 2022
1b1cc11
Merge branch 'master' into leo/add-jobqueue-README
zhangchiqing May 24, 2022
61e1535
add comment
zhangchiqing May 24, 2022
8c5e6ab
Apply suggestions from code review
zhangchiqing May 24, 2022
b7cb77b
Reduce allocs/op by 79% in ledger read
fxamacker May 24, 2022
f9b8076
Fix tests
fxamacker May 24, 2022
ee5ab90
Update Forest.Read() callers to use new API
fxamacker May 24, 2022
31d144c
Speedup and reduce allocs/op in ledger single read
fxamacker May 25, 2022
c8b2bc5
Move a line outside for-loop in readSinglePayload
fxamacker May 25, 2022
130cff5
Merge branch 'master' into fxamacker/remove-key-comparison-in-payload…
fxamacker May 25, 2022
a47df9f
Read memory limit from state
janezpodhostnik May 13, 2022
2fa8a8d
Fixed memory metering crasher and tests
janezpodhostnik May 13, 2022
a389332
fixed tests
May 24, 2022
299e927
add tests for script mutations
dsainati1 May 25, 2022
6f9c158
update cadence dep
May 25, 2022
4bc4adc
mod tidy
May 25, 2022
efab5c6
go mod tidy integration
May 25, 2022
b2d1347
Merge branch 'master' into fxamacker/add-hashcollision-reporter
fxamacker May 25, 2022
5cdb692
do not split always fatal error
May 25, 2022
91fa008
add tests to manager for discarding computations in scripts
dsainati1 May 25, 2022
0b4e8ca
Merge branch 'master' of github.com:onflow/flow-go into script-mutati…
dsainati1 May 25, 2022
8229051
fix test
May 25, 2022
9b88846
assume service account exists
May 25, 2022
f74e476
Merge branch 'master' into robert/mlim-n-stt
robert-e-davidson3 May 25, 2022
0706a47
update test for discarding storage mutations
dsainati1 May 25, 2022
add055f
test fail on error
May 25, 2022
371590e
if memory limit not set in service acct then default to max
May 25, 2022
22c5755
lint
May 25, 2022
3abc7b4
better fix: return was missing
May 25, 2022
c50ca2d
accidentally added files
May 25, 2022
e8052b1
removed finished TODO
May 25, 2022
a20ba3f
Merge pull request #2477 from onflow/fxamacker/optimize-ledger-read-a…
fxamacker May 25, 2022
8ac1003
Merge branch 'master' into fxamacker/optimize-reading-single-register
fxamacker May 25, 2022
8a964e8
Merge pull request #2473 from onflow/fxamacker/optimize-reading-singl…
fxamacker May 25, 2022
fdef9bb
handling unexpected error
zhangchiqing May 26, 2022
5c9c14b
cleanup unused fields from loader
SaveTheRbtz May 24, 2022
37049b1
add test cases
zhangchiqing May 26, 2022
b895990
update tests
zhangchiqing May 26, 2022
14a9a52
fix lint
dsainati1 May 26, 2022
e57e36b
fix error wrapping
zhangchiqing May 26, 2022
34c82cc
Merge branch 'master' of github.com:onflow/flow-go into script-mutati…
dsainati1 May 26, 2022
46c91ea
Merge branch 'master' into fxamacker/remove-key-comparison-in-payload…
fxamacker May 26, 2022
73713f6
upload log level for memory weights
zhangchiqing May 26, 2022
f6ee466
Merge pull request #2201 from onflow/fxamacker/remove-key-comparison-…
fxamacker May 26, 2022
b59ca46
add test
synzhu May 26, 2022
8498ab3
Merge branch 'master' into smnzhu/component_manager_fix
synzhu May 26, 2022
e3a1671
Merge #2349 #2470
bors[bot] May 26, 2022
c1561d4
Merge branch 'master' into script-mutation-test
dsainati1 May 26, 2022
9e0387d
Merge branch 'master' into script-mutation-test
dsainati1 May 26, 2022
56fa093
Merge pull request #2482 from onflow/script-mutation-test
dsainati1 May 26, 2022
d53b101
[Fix] Adding sync request message as a cluster type message (#2495)
yhassanzadeh13 May 26, 2022
e93d36b
upgrade cadence to secure-cadence-m8
janezpodhostnik May 26, 2022
7163bdb
Merge branch 'master' into sideninja/codeowners-patch
tarakby May 26, 2022
e4cf8d9
Merge #2448
bors[bot] May 26, 2022
6d33589
update error handling
zhangchiqing May 27, 2022
3e8f4e1
fix test case
zhangchiqing May 27, 2022
05748ae
flaky tests fix test async uploader - Test_AsyncUploader/stopping_com…
gomisha May 27, 2022
389fb3c
Review updates
janezpodhostnik May 27, 2022
29b4439
Test fix
janezpodhostnik May 27, 2022
342782d
change test fix
janezpodhostnik May 27, 2022
e50ac5f
Merge #2499
bors[bot] May 27, 2022
eb5f550
chore(tests): fix init-light
SaveTheRbtz May 27, 2022
d62a50b
Merge #2508
bors[bot] May 27, 2022
7f159d5
use seeded math rand and log the seed
tarakby May 28, 2022
4999640
bump the samples in a statistical test
tarakby May 28, 2022
cf8a43c
chore(tests): do not go through the resolver for localhost
SaveTheRbtz May 29, 2022
566530d
chore(tests): mark localnet and benchmarks owned by the performance team
SaveTheRbtz May 29, 2022
3bbab04
fix test case
zhangchiqing May 30, 2022
309d40c
add blockheight to transaction result response
lolpuddle May 30, 2022
a7bb6a3
fix test case
zhangchiqing May 30, 2022
214322f
Merge #2373 #2493
bors[bot] May 30, 2022
457ff1b
add test case
zhangchiqing May 30, 2022
afdbfce
handle guarantee.ReferenceBlockID not found
zhangchiqing May 30, 2022
e87108c
fix assigner tests
zhangchiqing May 30, 2022
ce8a632
fix linter
zhangchiqing May 30, 2022
632d860
fix reader tests
zhangchiqing May 30, 2022
6bd20b7
upgrade cadence to secure-cadence-m9
j1010001 May 30, 2022
f3fcf65
tidy go mods
j1010001 May 30, 2022
98e3c67
Merge pull request #2516 from onflow/jan/upgrade-secure-cadence-m9
j1010001 May 31, 2022
4b0a2fd
Merge #2512
bors[bot] May 31, 2022
f8039bd
chore(tests): remove unused batchLoadGenerator
SaveTheRbtz May 31, 2022
5ea0fde
added ctx timeout, constant var for queue size, used ProcessLocal in …
danielholmes839 May 31, 2022
d40dc52
fix naming in limit script
janezpodhostnik May 31, 2022
43db9c1
Merge branch 'master' of github.com:onflow/flow-go into robert/mlim-n…
janezpodhostnik May 31, 2022
c844caa
added TearDownTest to cancel context
danielholmes839 May 31, 2022
5564b85
cancel context
danielholmes839 May 31, 2022
98dc45b
Merge #2474
bors[bot] May 31, 2022
e7fc436
processAvailableMessage approach
danielholmes839 May 31, 2022
3dee9ef
go fmt
danielholmes839 May 31, 2022
e456965
Merge branch 'master' into dan/migrate-ingestion-engine
danielholmes839 May 31, 2022
b3aa067
go fmt
danielholmes839 May 31, 2022
444c768
fix lint error
danielholmes839 May 31, 2022
12250a6
Upgrades libp2p pubsub version (#2515)
yhassanzadeh13 May 31, 2022
0f91d4d
Merge branch 'master' into petera/execution-data-requester
peterargue May 31, 2022
ad12607
generate mocks, make tidy
peterargue May 31, 2022
87f2261
error fix
lolpuddle May 31, 2022
ca82dfd
go mod update
lolpuddle May 31, 2022
1f0d3a7
update mocks
lolpuddle May 31, 2022
106f81b
Suggestion for PR #2462 (#2517)
May 31, 2022
c39b924
Apply suggestions from code review
zhangchiqing May 31, 2022
d823860
Merge branch 'leo/validate-guarantors' of github.com:onflow/flow-go i…
zhangchiqing May 31, 2022
06b0a64
fix linter
zhangchiqing May 31, 2022
c7e6ab6
exit validation early for empty collections
jordanschalm May 31, 2022
8233e8e
lint
jordanschalm May 31, 2022
84c948f
Update state/cluster/badger/mutator.go
jordanschalm May 31, 2022
ba872b7
Merge branch 'jordan/6259-tx-dedup' of github.com:onflow/flow-go into…
jordanschalm May 31, 2022
f5468c4
fix tests
zhangchiqing May 31, 2022
8134634
Merge branch 'master' into leo/validate-guarantors
zhangchiqing May 31, 2022
644903e
update test
jordanschalm May 31, 2022
44b9242
extract decodeSignerIndices
zhangchiqing May 31, 2022
25d331d
small refactor
zhangchiqing Jun 1, 2022
9bb9c65
Merge branch 'master' into rbtz/go_workspace
SaveTheRbtz Jun 1, 2022
c96e194
Merge #2462
bors[bot] Jun 1, 2022
d39b4e6
update to Cadence 8b113c539a2c
turbolent Jun 1, 2022
c2e9ec3
block nil check
lolpuddle Jun 1, 2022
180e3ee
Merge branch 'master' into rbtz/go_workspace
SaveTheRbtz Jun 1, 2022
d2d08c5
Merge #2469
bors[bot] Jun 1, 2022
90ff625
Merge branch 'master' into bastian/update-cadence
j1010001 Jun 1, 2022
a099e69
Merge pull request #2525 from onflow/bastian/update-cadence
j1010001 Jun 1, 2022
a984d74
Merge branch 'master' into fxamacker/add-hashcollision-reporter
fxamacker Jun 1, 2022
9061179
Merge branch 'master' into alex/outdated_block_proposal_error
Jun 1, 2022
3173628
Merge pull request #2461 from onflow/fxamacker/add-hashcollision-repo…
fxamacker Jun 1, 2022
6878ceb
workaround for handling hotstuff error
jordanschalm Jun 1, 2022
f083678
check that reference block is known
jordanschalm Jun 1, 2022
e7cd660
Merge #2372
bors[bot] Jun 1, 2022
849908a
fix merge conflicts
peterargue Jun 1, 2022
d247214
removed disableProcessBackground flag
danielholmes839 Jun 1, 2022
a700f36
Merge branch 'master' into jordan/6259-tx-dedup
jordanschalm Jun 1, 2022
3611898
height is already set here
lolpuddle Jun 1, 2022
151fb87
add blockheight
lolpuddle Jun 1, 2022
e51c9c8
Merge branch 'master' into petera/execution-data-requester
peterargue Jun 1, 2022
f79f06a
blockheight for historical transaction request
lolpuddle Jun 1, 2022
ad3755a
Merge #1895
bors[bot] Jun 1, 2022
6a4c01d
test blockheight equivalence
lolpuddle Jun 1, 2022
d361896
Merge #2514
bors[bot] Jun 1, 2022
127944c
Merge #2524
bors[bot] Jun 1, 2022
c2875b8
upgrade flow to v0.3.1 (#2534)
zhangchiqing Jun 1, 2022
20c36c8
Merge branch 'master' into kan/add-secure-cadence-to-make-file-master
Kay-Zee Jun 1, 2022
41b69ea
Merge branch 'master' into tarak/crypto-rand-tests
tarakby Jun 1, 2022
2b3b2a4
Merge #2509
bors[bot] Jun 1, 2022
8c25786
Merge #2167
bors[bot] Jun 2, 2022
c44f40d
Merge #2511
bors[bot] Jun 2, 2022
24c756b
Merge #2519
bors[bot] Jun 2, 2022
a112b64
Merge branch 'master' into dan/migrate-ingestion-engine
danielholmes839 Jun 2, 2022
e4b4451
Merge pull request #2436 from onflow/dan/migrate-ingestion-engine
danielholmes839 Jun 2, 2022
8e9b329
add explicit mapping of cluster prefix -> message codes
kc1116 Jun 2, 2022
d08b33e
Merge pull request #2539 from onflow/khalil-fix-cluster-messages
kc1116 Jun 2, 2022
caf08db
Merge branch 'master' into leo/v0.26.3-merge-master
zhangchiqing Jun 2, 2022
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHORT_COMMIT := $(shell git rev-parse --short HEAD)
# The Git commit hash
COMMIT := $(shell git rev-parse HEAD)
# The tag of the current commit, otherwise empty
VERSION := $(shell git describe --tags --abbrev=2 --match "v*" 2>/dev/null)
VERSION := $(shell git describe --tags --abbrev=2 --match "v*" --match "secure-cadence*" 2>/dev/null)

# Image tag: if image tag is not set, set it with version (or short commit if empty)
ifeq (${IMAGE_TAG},)
Expand Down
50 changes: 31 additions & 19 deletions crypto/random/rand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package random

import (
"bytes"
crand "crypto/rand"
"fmt"
mrand "math/rand"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -82,26 +82,33 @@ func TestChacha20Compliance(t *testing.T) {
})
}

func seedMathRand(t *testing.T) {
r := time.Now().UnixNano()
rand.Seed(r)
t.Logf("math rand seed is %d", r)
}

// The tests are targeting the PRG implementations in the package.
// For now, the tests are only used for Chacha20 PRG, but can be ported
// to test another PRG implementation.

// Simple unit testing of Uint using a very basic randomness test.
// It doesn't evaluate randomness of the output and doesn't perform advanced statistical tests.
func TestUint(t *testing.T) {
seedMathRand(t)

seed := make([]byte, Chacha20SeedLen)
crand.Read(seed)
rand.Read(seed)
customizer := make([]byte, Chacha20CustomizerMaxLen)
crand.Read(customizer)
rand.Read(customizer)

rng, err := NewChacha20PRG(seed, customizer)
require.NoError(t, err)

t.Run("basic randomness", func(t *testing.T) {
sampleSize := 80000
tolerance := 0.05
sampleSpace := uint64(10 + mrand.Intn(100))
sampleSpace := uint64(10 + rand.Intn(100))
distribution := make([]float64, sampleSpace)

for i := 0; i < sampleSize; i++ {
Expand All @@ -126,11 +133,12 @@ func TestUint(t *testing.T) {
//
// SubPermutation tests cover Permutation as well.
func TestSubPermutation(t *testing.T) {
seedMathRand(t)

seed := make([]byte, Chacha20SeedLen)
crand.Read(seed)
rand.Read(seed)
customizer := make([]byte, Chacha20CustomizerMaxLen)
crand.Read(customizer)
rand.Read(customizer)

rng, err := NewChacha20PRG(seed, customizer)
require.NoError(t, err)
Expand All @@ -141,13 +149,13 @@ func TestSubPermutation(t *testing.T) {
subsetSize := 20

// statictics parameters
sampleSize := 80000
sampleSize := 85000
tolerance := 0.05
// tests the subset sampling randomness
samplingDistribution := make([]float64, listSize)
// tests the subset ordering randomness (using a particular element testElement)
orderingDistribution := make([]float64, subsetSize)
testElement := mrand.Intn(listSize)
testElement := rand.Intn(listSize)

for i := 0; i < sampleSize; i++ {
shuffledlist, err := rng.SubPermutation(listSize, subsetSize)
Expand Down Expand Up @@ -208,11 +216,12 @@ func TestSubPermutation(t *testing.T) {
// Simple unit testing of Shuffle using a very basic randomness test.
// It doesn't evaluate randomness of the output and doesn't perform advanced statistical tests.
func TestShuffle(t *testing.T) {
seedMathRand(t)

seed := make([]byte, Chacha20SeedLen)
crand.Read(seed)
rand.Read(seed)
customizer := make([]byte, Chacha20CustomizerMaxLen)
crand.Read(customizer)
rand.Read(customizer)

rng, err := NewChacha20PRG(seed, customizer)
require.NoError(t, err)
Expand All @@ -224,7 +233,7 @@ func TestShuffle(t *testing.T) {
tolerance := 0.05
// the distribution of a particular element of the list, testElement
distribution := make([]float64, listSize)
testElement := mrand.Intn(listSize)
testElement := rand.Intn(listSize)
// Slice to shuffle
list := make([]int, 0, listSize)
for i := 0; i < listSize; i++ {
Expand Down Expand Up @@ -290,11 +299,12 @@ func TestShuffle(t *testing.T) {
}

func TestSamples(t *testing.T) {
seedMathRand(t)

seed := make([]byte, Chacha20SeedLen)
crand.Read(seed)
rand.Read(seed)
customizer := make([]byte, Chacha20CustomizerMaxLen)
crand.Read(customizer)
rand.Read(customizer)

rng, err := NewChacha20PRG(seed, customizer)
require.NoError(t, err)
Expand All @@ -311,7 +321,7 @@ func TestSamples(t *testing.T) {
samplingDistribution := make([]float64, listSize)
// tests the subset ordering randomness (using a particular element testElement)
orderingDistribution := make([]float64, samplesSize)
testElement := mrand.Intn(listSize)
testElement := rand.Intn(listSize)
// Slice to shuffle
list := make([]int, 0, listSize)
for i := 0; i < listSize; i++ {
Expand Down Expand Up @@ -380,19 +390,21 @@ func TestSamples(t *testing.T) {
// TestStateRestore tests the serilaization and deserialization functions
// Store and Restore
func TestStateRestore(t *testing.T) {
seedMathRand(t)

// generate a seed
seed := make([]byte, Chacha20SeedLen)
crand.Read(seed)
rand.Read(seed)
customizer := make([]byte, Chacha20CustomizerMaxLen)
crand.Read(customizer)
rand.Read(customizer)
t.Logf("seed is %x, customizer is %x\n", seed, customizer)

// create an rng
rng, err := NewChacha20PRG(seed, customizer)
require.NoError(t, err)

// evolve the internal state of the rng
iterations := mrand.Intn(1000)
iterations := rand.Intn(1000)
for i := 0; i < iterations; i++ {
_ = rng.UintN(1024)
}
Expand All @@ -409,7 +421,7 @@ func TestStateRestore(t *testing.T) {
assert.True(t, bytes.Equal(state, secondRng.Store()), "Store o Restore is not identity")

// check the 2 PRGs are generating identical outputs
iterations = mrand.Intn(1000)
iterations = rand.Intn(1000)
for i := 0; i < iterations; i++ {
rand1 := rng.UintN(1024)
rand2 := secondRng.UintN(1024)
Expand Down
24 changes: 19 additions & 5 deletions engine/access/access_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"os"
"testing"
"time"

"github.com/dgraph-io/badger/v2"
accessproto "github.com/onflow/flow/protobuf/go/flow/access"
Expand All @@ -30,6 +29,7 @@ import (
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/model/flow/factory"
"github.com/onflow/flow-go/model/flow/filter"
"github.com/onflow/flow-go/module/irrecoverable"
"github.com/onflow/flow-go/module/mempool/stdmap"
"github.com/onflow/flow-go/module/metrics"
module "github.com/onflow/flow-go/module/mock"
Expand Down Expand Up @@ -621,6 +621,13 @@ func (suite *Suite) TestGetSealedTransaction() {
transactions, results, receipts, metrics, collectionsToMarkFinalized, collectionsToMarkExecuted, blocksToMarkExecuted, rpcEng)
require.NoError(suite.T(), err)

background, cancel := context.WithCancel(context.Background())
defer cancel()

ctx, _ := irrecoverable.WithSignaler(background)
ingestEng.Start(ctx)
<-ingestEng.Ready()

// 1. Assume that follower engine updated the block storage and the protocol state. The block is reported as sealed
err = blocks.Store(&block)
require.NoError(suite.T(), err)
Expand All @@ -643,7 +650,6 @@ func (suite *Suite) TestGetSealedTransaction() {
err = ingestEng.Process(engine.ReceiveReceipts, enNodeIDs[0], r)
require.NoError(suite.T(), err)
}
unittest.AssertClosesBefore(suite.T(), ingestEng.Done(), 3*time.Second)

// 5. Client requests a transaction
tx := collection.Transactions[0]
Expand Down Expand Up @@ -747,9 +753,6 @@ func (suite *Suite) TestExecuteScript() {
require.NoError(suite.T(), err)
}

// wait for the receipt to be persisted
unittest.AssertClosesBefore(suite.T(), ingestEng.Done(), 3*time.Second)

ctx := context.Background()

script := []byte("dummy script")
Expand Down Expand Up @@ -781,6 +784,9 @@ func (suite *Suite) TestExecuteScript() {

suite.Run("execute script at latest block", func() {
suite.state.On("Sealed").Return(suite.snapshot, nil).Maybe()
suite.state.
On("AtBlockID", lastBlock.ID()).
Return(suite.snapshot, nil)

expectedResp := setupExecClientMock(lastBlock.ID())
req := accessproto.ExecuteScriptAtLatestBlockRequest{
Expand All @@ -791,6 +797,10 @@ func (suite *Suite) TestExecuteScript() {
})

suite.Run("execute script at block id", func() {
suite.state.
On("AtBlockID", prevBlock.ID()).
Return(suite.snapshot, nil)

expectedResp := setupExecClientMock(prevBlock.ID())
id := prevBlock.ID()
req := accessproto.ExecuteScriptAtBlockIDRequest{
Expand All @@ -802,6 +812,10 @@ func (suite *Suite) TestExecuteScript() {
})

suite.Run("execute script at block height", func() {
suite.state.
On("AtBlockID", prevBlock.ID()).
Return(suite.snapshot, nil)

expectedResp := setupExecClientMock(prevBlock.ID())
req := accessproto.ExecuteScriptAtBlockHeightRequest{
BlockHeight: prevBlock.Header.Height,
Expand Down
Loading