From 4c09e59b3b0a88eec08990f77645217573ff04eb Mon Sep 17 00:00:00 2001 From: Victor Farazdagi Date: Sat, 10 Oct 2020 06:54:31 +0300 Subject: [PATCH] Remove duplicate imports (#7491) Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- beacon-chain/blockchain/head.go | 9 +- .../core/blocks/block_operations_fuzz_test.go | 86 +++++++++---------- beacon-chain/core/helpers/signing_root.go | 3 +- beacon-chain/db/iface/interface.go | 7 +- beacon-chain/db/kafka/passthrough.go | 7 +- beacon-chain/rpc/beacon/validators_test.go | 7 +- beacon-chain/state/stategen/replay.go | 5 +- 7 files changed, 58 insertions(+), 66 deletions(-) diff --git a/beacon-chain/blockchain/head.go b/beacon-chain/blockchain/head.go index 1bba5afd0..42b649c58 100644 --- a/beacon-chain/blockchain/head.go +++ b/beacon-chain/blockchain/head.go @@ -11,7 +11,6 @@ import ( statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray" - "github.com/prysmaticlabs/prysm/beacon-chain/state" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/params" @@ -24,7 +23,7 @@ type head struct { slot uint64 // current head slot. root [32]byte // current head root. block *ethpb.SignedBeaconBlock // current head block. - state *state.BeaconState // current head state. + state *stateTrie.BeaconState // current head state. } // Determined the head from the fork choice service and saves its new data @@ -136,7 +135,7 @@ func (s *Service) saveHead(ctx context.Context, headRoot [32]byte) error { // This gets called to update canonical root mapping. It does not save head block // root in DB. With the inception of initial-sync-cache-state flag, it uses finalized // check point as anchors to resume sync therefore head is no longer needed to be saved on per slot basis. -func (s *Service) saveHeadNoDB(ctx context.Context, b *ethpb.SignedBeaconBlock, r [32]byte, hs *state.BeaconState) error { +func (s *Service) saveHeadNoDB(ctx context.Context, b *ethpb.SignedBeaconBlock, r [32]byte, hs *stateTrie.BeaconState) error { cachedHeadRoot, err := s.HeadRoot(ctx) if err != nil { return errors.Wrap(err, "could not get head root from cache") @@ -154,7 +153,7 @@ func (s *Service) saveHeadNoDB(ctx context.Context, b *ethpb.SignedBeaconBlock, } // This sets head view object which is used to track the head slot, root, block and state. -func (s *Service) setHead(root [32]byte, block *ethpb.SignedBeaconBlock, state *state.BeaconState) { +func (s *Service) setHead(root [32]byte, block *ethpb.SignedBeaconBlock, state *stateTrie.BeaconState) { s.headLock.Lock() defer s.headLock.Unlock() @@ -170,7 +169,7 @@ func (s *Service) setHead(root [32]byte, block *ethpb.SignedBeaconBlock, state * // This sets head view object which is used to track the head slot, root, block and state. The method // assumes that state being passed into the method will not be modified by any other alternate // caller which holds the state's reference. -func (s *Service) setHeadInitialSync(root [32]byte, block *ethpb.SignedBeaconBlock, state *state.BeaconState) { +func (s *Service) setHeadInitialSync(root [32]byte, block *ethpb.SignedBeaconBlock, state *stateTrie.BeaconState) { s.headLock.Lock() defer s.headLock.Unlock() diff --git a/beacon-chain/core/blocks/block_operations_fuzz_test.go b/beacon-chain/core/blocks/block_operations_fuzz_test.go index e3433a4d0..ebf71ff5d 100644 --- a/beacon-chain/core/blocks/block_operations_fuzz_test.go +++ b/beacon-chain/core/blocks/block_operations_fuzz_test.go @@ -6,9 +6,7 @@ import ( fuzz "github.com/google/gofuzz" eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - beaconstate "github.com/prysmaticlabs/prysm/beacon-chain/state" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" - ethereum_beacon_p2p_v1 "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -17,13 +15,13 @@ import ( func TestFuzzProcessAttestationNoVerify_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) ctx := context.Background() - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} att := ð.Attestation{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(att) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) _, err = ProcessAttestationNoVerifySignature(ctx, s, att) _ = err @@ -32,14 +30,14 @@ func TestFuzzProcessAttestationNoVerify_10000(t *testing.T) { func TestFuzzProcessBlockHeader_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} block := ð.SignedBeaconBlock{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(block) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) _, err = ProcessBlockHeader(context.Background(), s, block) _ = err @@ -104,7 +102,7 @@ func TestFuzzEth1DataHasEnoughSupport_10000(t *testing.T) { for i := 0; i < 100000; i++ { fuzzer.Fuzz(eth1data) fuzzer.Fuzz(&stateVotes) - s, err := beaconstate.InitializeFromProto(ðereum_beacon_p2p_v1.BeaconState{ + s, err := stateTrie.InitializeFromProto(&pb.BeaconState{ Eth1DataVotes: stateVotes, }) require.NoError(t, err) @@ -116,13 +114,13 @@ func TestFuzzEth1DataHasEnoughSupport_10000(t *testing.T) { func TestFuzzProcessBlockHeaderNoVerify_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} block := ð.BeaconBlock{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(block) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) _, err = ProcessBlockHeaderNoVerify(s, block) _ = err @@ -131,13 +129,13 @@ func TestFuzzProcessBlockHeaderNoVerify_10000(t *testing.T) { func TestFuzzProcessRandao_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessRandao(context.Background(), s, b) if err != nil && r != nil { @@ -148,13 +146,13 @@ func TestFuzzProcessRandao_10000(t *testing.T) { func TestFuzzProcessRandaoNoVerify_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} blockBody := ð.BeaconBlockBody{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(blockBody) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessRandaoNoVerify(s, blockBody) if err != nil && r != nil { @@ -165,13 +163,13 @@ func TestFuzzProcessRandaoNoVerify_10000(t *testing.T) { func TestFuzzProcessProposerSlashings_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessProposerSlashings(ctx, s, b) if err != nil && r != nil { @@ -182,12 +180,12 @@ func TestFuzzProcessProposerSlashings_10000(t *testing.T) { func TestFuzzVerifyProposerSlashing_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} proposerSlashing := ð.ProposerSlashing{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(proposerSlashing) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) err = VerifyProposerSlashing(s, proposerSlashing) _ = err @@ -196,13 +194,13 @@ func TestFuzzVerifyProposerSlashing_10000(t *testing.T) { func TestFuzzProcessAttesterSlashings_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessAttesterSlashings(ctx, s, b) if err != nil && r != nil { @@ -213,13 +211,13 @@ func TestFuzzProcessAttesterSlashings_10000(t *testing.T) { func TestFuzzVerifyAttesterSlashing_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} attesterSlashing := ð.AttesterSlashing{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(attesterSlashing) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) err = VerifyAttesterSlashing(ctx, s, attesterSlashing) _ = err @@ -250,13 +248,13 @@ func TestFuzzslashableAttesterIndices_10000(t *testing.T) { func TestFuzzProcessAttestations_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessAttestations(ctx, s, b) if err != nil && r != nil { @@ -267,13 +265,13 @@ func TestFuzzProcessAttestations_10000(t *testing.T) { func TestFuzzProcessAttestationsNoVerify_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessAttestationsNoVerifySignature(ctx, s, b) if err != nil && r != nil { @@ -284,13 +282,13 @@ func TestFuzzProcessAttestationsNoVerify_10000(t *testing.T) { func TestFuzzProcessAttestation_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} attestation := ð.Attestation{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(attestation) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessAttestation(ctx, s, attestation) if err != nil && r != nil { @@ -301,13 +299,13 @@ func TestFuzzProcessAttestation_10000(t *testing.T) { func TestFuzzVerifyIndexedAttestationn_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} idxAttestation := ð.IndexedAttestation{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(idxAttestation) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) err = VerifyIndexedAttestation(ctx, s, idxAttestation) _ = err @@ -316,13 +314,13 @@ func TestFuzzVerifyIndexedAttestationn_10000(t *testing.T) { func TestFuzzVerifyAttestation_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} attestation := ð.Attestation{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(attestation) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) err = VerifyAttestationSignature(ctx, s, attestation) _ = err @@ -331,13 +329,13 @@ func TestFuzzVerifyAttestation_10000(t *testing.T) { func TestFuzzProcessDeposits_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessDeposits(ctx, s, b) if err != nil && r != nil { @@ -348,14 +346,14 @@ func TestFuzzProcessDeposits_10000(t *testing.T) { func TestFuzzProcessPreGenesisDeposit_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} deposit := ð.Deposit{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(deposit) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessPreGenesisDeposits(ctx, s, []*eth.Deposit{deposit}) if err != nil && r != nil { @@ -366,13 +364,13 @@ func TestFuzzProcessPreGenesisDeposit_10000(t *testing.T) { func TestFuzzProcessDeposit_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} deposit := ð.Deposit{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(deposit) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessDeposit(s, deposit, true) if err != nil && r != nil { @@ -383,12 +381,12 @@ func TestFuzzProcessDeposit_10000(t *testing.T) { func TestFuzzverifyDeposit_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} deposit := ð.Deposit{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(deposit) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) err = verifyDeposit(s, deposit) _ = err @@ -397,13 +395,13 @@ func TestFuzzverifyDeposit_10000(t *testing.T) { func TestFuzzProcessVoluntaryExits_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} ctx := context.Background() for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessVoluntaryExits(ctx, s, b) if err != nil && r != nil { @@ -414,12 +412,12 @@ func TestFuzzProcessVoluntaryExits_10000(t *testing.T) { func TestFuzzProcessVoluntaryExitsNoVerify_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) - state := ðereum_beacon_p2p_v1.BeaconState{} + state := &pb.BeaconState{} b := ð.SignedBeaconBlock{} for i := 0; i < 10000; i++ { fuzzer.Fuzz(state) fuzzer.Fuzz(b) - s, err := beaconstate.InitializeFromProtoUnsafe(state) + s, err := stateTrie.InitializeFromProtoUnsafe(state) require.NoError(t, err) r, err := ProcessVoluntaryExits(context.Background(), s, b) if err != nil && r != nil { @@ -431,7 +429,7 @@ func TestFuzzProcessVoluntaryExitsNoVerify_10000(t *testing.T) { func TestFuzzVerifyExit_10000(t *testing.T) { fuzzer := fuzz.NewWithSeed(0) ve := ð.SignedVoluntaryExit{} - val := &beaconstate.ReadOnlyValidator{} + val := &stateTrie.ReadOnlyValidator{} fork := &pb.Fork{} var slot uint64 diff --git a/beacon-chain/core/helpers/signing_root.go b/beacon-chain/core/helpers/signing_root.go index 9df1e5f99..51657c903 100644 --- a/beacon-chain/core/helpers/signing_root.go +++ b/beacon-chain/core/helpers/signing_root.go @@ -6,7 +6,6 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/go-ssz" "github.com/prysmaticlabs/prysm/beacon-chain/state" - p2ppb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" @@ -66,7 +65,7 @@ func signingData(rootFunc func() ([32]byte, error), domain []byte) ([32]byte, er if err != nil { return [32]byte{}, err } - container := &p2ppb.SigningData{ + container := &pb.SigningData{ ObjectRoot: objRoot[:], Domain: domain, } diff --git a/beacon-chain/db/iface/interface.go b/beacon-chain/db/iface/interface.go index b25ddc8f3..95770ef8b 100644 --- a/beacon-chain/db/iface/interface.go +++ b/beacon-chain/db/iface/interface.go @@ -9,7 +9,6 @@ import ( "github.com/ethereum/go-ethereum/common" eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/db/filters" "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/proto/beacon/db" @@ -23,10 +22,10 @@ type ReadOnlyDatabase interface { Blocks(ctx context.Context, f *filters.QueryFilter) ([]*eth.SignedBeaconBlock, error) BlockRoots(ctx context.Context, f *filters.QueryFilter) ([][32]byte, error) HasBlock(ctx context.Context, blockRoot [32]byte) bool - GenesisBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error) + GenesisBlock(ctx context.Context) (*eth.SignedBeaconBlock, error) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool - FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error) - HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*ethpb.SignedBeaconBlock, error) + FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (*eth.SignedBeaconBlock, error) + HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*eth.SignedBeaconBlock, error) // State related methods. State(ctx context.Context, blockRoot [32]byte) (*state.BeaconState, error) GenesisState(ctx context.Context) (*state.BeaconState, error) diff --git a/beacon-chain/db/kafka/passthrough.go b/beacon-chain/db/kafka/passthrough.go index 047e9eee6..a60c46a71 100644 --- a/beacon-chain/db/kafka/passthrough.go +++ b/beacon-chain/db/kafka/passthrough.go @@ -5,7 +5,6 @@ import ( "github.com/ethereum/go-ethereum/common" eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" - ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/db/filters" "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/proto/beacon/db" @@ -123,7 +122,7 @@ func (e Exporter) SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) err } // GenesisBlock -- passthrough. -func (e Exporter) GenesisBlock(ctx context.Context) (*ethpb.SignedBeaconBlock, error) { +func (e Exporter) GenesisBlock(ctx context.Context) (*eth.SignedBeaconBlock, error) { return e.db.GenesisBlock(ctx) } @@ -208,7 +207,7 @@ func (e Exporter) IsFinalizedBlock(ctx context.Context, blockRoot [32]byte) bool } // FinalizedChildBlock -- passthrough. -func (e Exporter) FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (*ethpb.SignedBeaconBlock, error) { +func (e Exporter) FinalizedChildBlock(ctx context.Context, blockRoot [32]byte) (*eth.SignedBeaconBlock, error) { return e.db.FinalizedChildBlock(ctx, blockRoot) } @@ -238,7 +237,7 @@ func (e Exporter) LastArchivedRoot(ctx context.Context) [32]byte { } // HighestSlotBlocksBelow -- passthrough -func (e Exporter) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*ethpb.SignedBeaconBlock, error) { +func (e Exporter) HighestSlotBlocksBelow(ctx context.Context, slot uint64) ([]*eth.SignedBeaconBlock, error) { return e.db.HighestSlotBlocksBelow(ctx, slot) } diff --git a/beacon-chain/rpc/beacon/validators_test.go b/beacon-chain/rpc/beacon/validators_test.go index 7ff3ee803..393b85514 100644 --- a/beacon-chain/rpc/beacon/validators_test.go +++ b/beacon-chain/rpc/beacon/validators_test.go @@ -23,7 +23,6 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/state/stategen" mockSync "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" - pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/params" @@ -1232,7 +1231,7 @@ func TestServer_GetValidatorActiveSetChanges(t *testing.T) { } func TestServer_GetValidatorQueue_PendingActivation(t *testing.T) { - headState, err := stateTrie.InitializeFromProto(&pbp2p.BeaconState{ + headState, err := stateTrie.InitializeFromProto(&pb.BeaconState{ Validators: []*ethpb.Validator{ { ActivationEpoch: helpers.ActivationExitEpoch(0), @@ -1330,7 +1329,7 @@ func TestServer_GetValidatorQueue_ExitedValidatorLeavesQueue(t *testing.T) { } func TestServer_GetValidatorQueue_PendingExit(t *testing.T) { - headState, err := stateTrie.InitializeFromProto(&pbp2p.BeaconState{ + headState, err := stateTrie.InitializeFromProto(&pb.BeaconState{ Validators: []*ethpb.Validator{ { ActivationEpoch: 0, @@ -1425,7 +1424,7 @@ func TestServer_GetValidatorParticipation_PrevEpoch(t *testing.T) { balances[i] = params.BeaconConfig().MaxEffectiveBalance } - atts := []*pbp2p.PendingAttestation{{ + atts := []*pb.PendingAttestation{{ Data: ðpb.AttestationData{ BeaconBlockRoot: make([]byte, 32), Source: ðpb.Checkpoint{ diff --git a/beacon-chain/state/stategen/replay.go b/beacon-chain/state/stategen/replay.go index d8d3caca8..6c8a6cac3 100644 --- a/beacon-chain/state/stategen/replay.go +++ b/beacon-chain/state/stategen/replay.go @@ -8,7 +8,6 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" transition "github.com/prysmaticlabs/prysm/beacon-chain/core/state" "github.com/prysmaticlabs/prysm/beacon-chain/db/filters" - "github.com/prysmaticlabs/prysm/beacon-chain/state" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/bytesutil" "github.com/prysmaticlabs/prysm/shared/featureconfig" @@ -16,7 +15,7 @@ import ( ) // ReplayBlocks replays the input blocks on the input state until the target slot is reached. -func (s *State) ReplayBlocks(ctx context.Context, state *state.BeaconState, signed []*ethpb.SignedBeaconBlock, targetSlot uint64) (*state.BeaconState, error) { +func (s *State) ReplayBlocks(ctx context.Context, state *stateTrie.BeaconState, signed []*ethpb.SignedBeaconBlock, targetSlot uint64) (*stateTrie.BeaconState, error) { ctx, span := trace.StartSpan(ctx, "stateGen.ReplayBlocks") defer span.End() @@ -230,7 +229,7 @@ func (s *State) lastSavedBlock(ctx context.Context, slot uint64) ([32]byte, uint // This finds the last saved state in DB from searching backwards from input slot, // it returns the block root of the block which was used to produce the state. // This is used by both hot and cold state management. -func (s *State) lastSavedState(ctx context.Context, slot uint64) (*state.BeaconState, error) { +func (s *State) lastSavedState(ctx context.Context, slot uint64) (*stateTrie.BeaconState, error) { ctx, span := trace.StartSpan(ctx, "stateGen.lastSavedState") defer span.End()