diff --git a/beacon-chain/powchain/log_processing.go b/beacon-chain/powchain/log_processing.go index 39c0522e1795..2da0ce4c588d 100644 --- a/beacon-chain/powchain/log_processing.go +++ b/beacon-chain/powchain/log_processing.go @@ -23,7 +23,6 @@ import ( "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/hashutil" "github.com/prysmaticlabs/prysm/shared/params" - "github.com/prysmaticlabs/prysm/shared/trieutil" "github.com/sirupsen/logrus" ) @@ -201,33 +200,16 @@ func (s *Service) ProcessChainStart(genesisTime uint64, eth1BlockHash [32]byte, s.chainStartData.GenesisBlock = blockNumber.Uint64() chainStartTime := time.Unix(int64(genesisTime), 0) - depHashes, err := s.ChainStartDepositHashes() - if err != nil { - log.Errorf("Generating chainstart deposit hashes failed: %v", err) - return - } - - // We then update the in-memory deposit trie from the chain start - // deposits at this point, as this trie will be later needed for - // incoming, post-chain start deposits. - sparseMerkleTrie, err := trieutil.GenerateTrieFromItems( - depHashes, - int(params.BeaconConfig().DepositContractTreeDepth), - ) - if err != nil { - log.Fatalf("Unable to generate deposit trie from ChainStart deposits: %v", err) - } for i := range s.chainStartData.ChainstartDeposits { - proof, err := sparseMerkleTrie.MerkleProof(i) + proof, err := s.depositTrie.MerkleProof(i) if err != nil { log.Errorf("Unable to generate deposit proof %v", err) } s.chainStartData.ChainstartDeposits[i].Proof = proof } - s.depositTrie = sparseMerkleTrie - root := sparseMerkleTrie.Root() + root := s.depositTrie.Root() s.chainStartData.Eth1Data = ðpb.Eth1Data{ DepositCount: uint64(len(s.chainStartData.ChainstartDeposits)), DepositRoot: root[:], @@ -393,17 +375,3 @@ func (s *Service) checkForChainStart(ctx context.Context, blkNum *big.Int) error } return nil } - -// ChainStartDepositHashes returns the hashes of all the chainstart deposits -// stored in memory. -func (s *Service) ChainStartDepositHashes() ([][]byte, error) { - hashes := make([][]byte, len(s.chainStartData.ChainstartDeposits)) - for i, dep := range s.chainStartData.ChainstartDeposits { - hash, err := ssz.HashTreeRoot(dep.Data) - if err != nil { - return nil, err - } - hashes[i] = hash[:] - } - return hashes, nil -} diff --git a/beacon-chain/powchain/testing/faulty_mock.go b/beacon-chain/powchain/testing/faulty_mock.go index b6832b6cd6da..439d1268bdb9 100644 --- a/beacon-chain/powchain/testing/faulty_mock.go +++ b/beacon-chain/powchain/testing/faulty_mock.go @@ -67,11 +67,6 @@ func (f *FaultyMockPOWChain) ChainStartDeposits() []*ethpb.Deposit { return []*ethpb.Deposit{} } -// ChainStartDepositHashes -- -func (f *FaultyMockPOWChain) ChainStartDepositHashes() ([][]byte, error) { - return [][]byte{}, errors.New("hashing failed") -} - // ChainStartEth1Data -- func (f *FaultyMockPOWChain) ChainStartEth1Data() *ethpb.Eth1Data { return ðpb.Eth1Data{} diff --git a/beacon-chain/powchain/testing/mock.go b/beacon-chain/powchain/testing/mock.go index 13e95189ec02..fd4989f84c40 100644 --- a/beacon-chain/powchain/testing/mock.go +++ b/beacon-chain/powchain/testing/mock.go @@ -86,11 +86,6 @@ func (m *POWChain) ChainStartDeposits() []*ethpb.Deposit { return []*ethpb.Deposit{} } -// ChainStartDepositHashes -- -func (m *POWChain) ChainStartDepositHashes() ([][]byte, error) { - return [][]byte{}, nil -} - // ChainStartEth1Data -- func (m *POWChain) ChainStartEth1Data() *ethpb.Eth1Data { return m.Eth1Data