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

Update fastssz: Attempt 2 #7115

Merged
merged 21 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
265b05a
Revert "Revert "Update fastssz" (#7100)"
terencechain Aug 25, 2020
0109747
Preston's patch
terencechain Aug 25, 2020
d139830
Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7…
prestonvanloon Aug 26, 2020
20f7aff
Update fssz, add regression test case
prestonvanloon Aug 26, 2020
e4d3918
more HTR with fssz
prestonvanloon Aug 26, 2020
ac94304
fix some tests
prestonvanloon Aug 26, 2020
b728a68
only one test left
prestonvanloon Aug 26, 2020
927aecc
Make it so that HTR will work
prestonvanloon Aug 26, 2020
0cb37d1
gofmt, imports
prestonvanloon Aug 26, 2020
a949973
gofmt, imports
prestonvanloon Aug 26, 2020
025cc21
fix
prestonvanloon Aug 27, 2020
4632df4
Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7…
prestonvanloon Aug 27, 2020
4a3ca21
fix
prestonvanloon Aug 27, 2020
522c3c5
Merge branch 'master' into revert-7100-revert-6760-update-fssz
prestonvanloon Aug 27, 2020
d62a7a0
Merge refs/heads/master into revert-7100-revert-6760-update-fssz
prylabs-bulldozer[bot] Aug 27, 2020
ae6cdd3
gaz
prestonvanloon Aug 27, 2020
50019ca
Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prys…
prestonvanloon Aug 27, 2020
ad18dca
Merge refs/heads/master into revert-7100-revert-6760-update-fssz
prylabs-bulldozer[bot] Aug 27, 2020
6925750
fix test
prestonvanloon Aug 27, 2020
5c1304d
Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prys…
prestonvanloon Aug 27, 2020
e190ea5
Merge refs/heads/master into revert-7100-revert-6760-update-fssz
prylabs-bulldozer[bot] Aug 27, 2020
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
8 changes: 4 additions & 4 deletions .buildkite-bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#
# This config is loaded from https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/latest.bazelrc
build:remote-cache --remote_timeout=3600
build:remote-cache --spawn_strategy=standalone
build:remote-cache --strategy=Javac=standalone
build:remote-cache --strategy=Closure=standalone
build:remote-cache --strategy=Genrule=standalone
#build:remote-cache --spawn_strategy=standalone
#build:remote-cache --strategy=Javac=standalone
#build:remote-cache --strategy=Closure=standalone
#build:remote-cache --strategy=Genrule=standalone

# Prysm specific remote-cache properties.
#build:remote-cache --disk_cache=
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/blockchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ go_library(
"//beacon-chain/powchain:go_default_library",
"//beacon-chain/state:go_default_library",
"//beacon-chain/state/stategen:go_default_library",
"//beacon-chain/state/stateutil:go_default_library",
"//proto/beacon/p2p/v1:go_default_library",
"//shared/attestationutil:go_default_library",
"//shared/bls:go_default_library",
Expand Down
6 changes: 3 additions & 3 deletions beacon-chain/blockchain/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"time"

ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
"go.opencensus.io/trace"

"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"go.opencensus.io/trace"
)

// ChainInfoFetcher defines a common interface for methods in blockchain service which
Expand Down Expand Up @@ -119,7 +119,7 @@ func (s *Service) HeadRoot(ctx context.Context) ([]byte, error) {
return params.BeaconConfig().ZeroHash[:], nil
}

r, err := stateutil.BlockRoot(b.Block)
r, err := b.Block.HashTreeRoot()
if err != nil {
return nil, err
}
Expand Down
11 changes: 7 additions & 4 deletions beacon-chain/blockchain/chain_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
"github.com/prysmaticlabs/prysm/beacon-chain/state"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
)
Expand All @@ -37,7 +39,7 @@ func TestHeadRoot_Nil(t *testing.T) {
func TestFinalizedCheckpt_CanRetrieve(t *testing.T) {
db, sc := testDB.SetupDB(t)

cp := &ethpb.Checkpoint{Epoch: 5, Root: []byte("foo")}
cp := &ethpb.Checkpoint{Epoch: 5, Root: bytesutil.PadTo([]byte("foo"), 32)}
c := setupBeaconChain(t, db, sc)
c.finalizedCheckpt = cp

Expand All @@ -58,7 +60,7 @@ func TestFinalizedCheckpt_GenesisRootOk(t *testing.T) {
func TestCurrentJustifiedCheckpt_CanRetrieve(t *testing.T) {
db, sc := testDB.SetupDB(t)

cp := &ethpb.Checkpoint{Epoch: 6, Root: []byte("foo")}
cp := &ethpb.Checkpoint{Epoch: 6, Root: bytesutil.PadTo([]byte("foo"), 32)}
c := setupBeaconChain(t, db, sc)
c.justifiedCheckpt = cp

Expand All @@ -79,7 +81,7 @@ func TestJustifiedCheckpt_GenesisRootOk(t *testing.T) {
func TestPreviousJustifiedCheckpt_CanRetrieve(t *testing.T) {
db, sc := testDB.SetupDB(t)

cp := &ethpb.Checkpoint{Epoch: 7, Root: []byte("foo")}
cp := &ethpb.Checkpoint{Epoch: 7, Root: bytesutil.PadTo([]byte("foo"), 32)}
c := setupBeaconChain(t, db, sc)
c.prevJustifiedCheckpt = cp
assert.Equal(t, cp.Epoch, c.PreviousJustifiedCheckpt().Epoch, "Unexpected previous justified epoch")
Expand Down Expand Up @@ -111,7 +113,8 @@ func TestHeadRoot_CanRetrieve(t *testing.T) {
}

func TestHeadBlock_CanRetrieve(t *testing.T) {
b := &ethpb.SignedBeaconBlock{Block: &ethpb.BeaconBlock{Slot: 1}}
b := testutil.NewBeaconBlock()
b.Block.Slot = 1
s, err := state.InitializeFromProto(&pb.BeaconState{})
require.NoError(t, err)
c := &Service{}
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/blockchain/checkpoint_info_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestHotStateCache_RoundTrip(t *testing.T) {
func TestHotStateCache_CanPrune(t *testing.T) {
c := newCheckPointInfoCache()
for i := 0; i < maxInfoSize+1; i++ {
cp := &ethpb.Checkpoint{Epoch: uint64(i)}
cp := &ethpb.Checkpoint{Epoch: uint64(i), Root: make([]byte, 32)}
require.NoError(t, c.put(cp, &pb.CheckPtInfo{}))
}
require.Equal(t, len(c.cache.Keys()), maxInfoSize)
Expand Down
20 changes: 9 additions & 11 deletions beacon-chain/blockchain/head_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import (
"context"
"testing"

ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateutil"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
"github.com/prysmaticlabs/prysm/shared/testutil"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
Expand Down Expand Up @@ -35,11 +33,12 @@ func TestSaveHead_Different(t *testing.T) {
oldRoot := [32]byte{'A'}
service.head = &head{slot: 0, root: oldRoot}

newHeadBlock := &ethpb.BeaconBlock{Slot: 1}
newHeadSignedBlock := &ethpb.SignedBeaconBlock{Block: newHeadBlock}
newHeadSignedBlock := testutil.NewBeaconBlock()
newHeadSignedBlock.Block.Slot = 1
newHeadBlock := newHeadSignedBlock.Block

require.NoError(t, service.beaconDB.SaveBlock(context.Background(), newHeadSignedBlock))
newRoot, err := stateutil.BlockRoot(newHeadBlock)
newRoot, err := newHeadBlock.HashTreeRoot()
require.NoError(t, err)
headState := testutil.NewBeaconState()
require.NoError(t, headState.SetSlot(1))
Expand Down Expand Up @@ -68,14 +67,13 @@ func TestSaveHead_Different_Reorg(t *testing.T) {
service.head = &head{slot: 0, root: oldRoot}

reorgChainParent := [32]byte{'B'}
newHeadBlock := &ethpb.BeaconBlock{
Slot: 1,
ParentRoot: reorgChainParent[:],
}
newHeadSignedBlock := &ethpb.SignedBeaconBlock{Block: newHeadBlock}
newHeadSignedBlock := testutil.NewBeaconBlock()
newHeadSignedBlock.Block.Slot = 1
newHeadSignedBlock.Block.ParentRoot = reorgChainParent[:]
newHeadBlock := newHeadSignedBlock.Block

require.NoError(t, service.beaconDB.SaveBlock(context.Background(), newHeadSignedBlock))
newRoot, err := stateutil.BlockRoot(newHeadBlock)
newRoot, err := newHeadBlock.HashTreeRoot()
require.NoError(t, err)
headState := testutil.NewBeaconState()
require.NoError(t, headState.SetSlot(1))
Expand Down
Loading