Fix Prysm Runtime Data Races (#7770)

* handle state trie data races

* race fixes

* added proper locks

* fix gaz

* use thread-safe refs() function
This commit is contained in:
Raul Jordan
2020-11-10 20:57:07 -06:00
committed by GitHub
parent 9e9a172248
commit 4290ba416c
7 changed files with 28 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ import (
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
dbtest "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
p2pt "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing"
"github.com/prysmaticlabs/prysm/shared/abool"
"github.com/prysmaticlabs/prysm/shared/sliceutil"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
@@ -293,8 +294,8 @@ func TestService_roundRobinSync(t *testing.T) {
chain: mc,
p2p: p,
db: beaconDB,
synced: false,
chainStarted: true,
synced: abool.New(),
chainStarted: abool.NewBool(true),
}
assert.NoError(t, s.roundRobinSync(makeGenesisTime(tt.currentSlot)))
if s.chain.HeadSlot() < tt.currentSlot {
@@ -524,8 +525,8 @@ func TestService_blockProviderScoring(t *testing.T) {
chain: mc,
p2p: p,
db: beaconDB,
synced: false,
chainStarted: true,
synced: abool.New(),
chainStarted: abool.NewBool(true),
}
scorer := s.p2p.Peers().Scorers().BlockProviderScorer()
expectedBlockSlots := makeSequence(1, 160)