Cleanups from eip4844 branch (#12109)

* Minor cleanups from eip4844 branch

* Add back handler

* Fix gazelle

* More fixes

* More fixes

---------

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
terencechain 2023-03-10 08:46:27 -08:00 committed by GitHub
parent 5eaa152589
commit 00b9e484e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 18 deletions

View File

@ -398,11 +398,7 @@ func populateValidators(cfg *params.BeaconChainConfig, st state.BeaconState, val
if err := st.SetValidators(validators); err != nil {
return err
}
if err := st.SetBalances(balances); err != nil {
return err
}
return nil
return st.SetBalances(balances)
}
func TestDownloadFinalizedData(t *testing.T) {

View File

@ -1314,7 +1314,7 @@ func fixtures() map[string]interface{} {
ReceiptsRoot: &common.Hash{'d'},
LogsBloom: &hexutil.Bytes{'e'},
PrevRandao: &common.Hash{'f'},
BaseFeePerGas: fmt.Sprintf("%s", "0x123"),
BaseFeePerGas: "0x123",
BlockHash: &common.Hash{'g'},
Transactions: []hexutil.Bytes{{'h'}},
Withdrawals: []*pb.Withdrawal{},
@ -1323,7 +1323,7 @@ func fixtures() map[string]interface{} {
GasUsed: &hexUint,
Timestamp: &hexUint,
},
BlockValue: fmt.Sprintf("%s", "0x11ff"),
BlockValue: "0x11ff",
}
parent := bytesutil.PadTo([]byte("parentHash"), fieldparams.RootLength)
sha3Uncles := bytesutil.PadTo([]byte("sha3Uncles"), fieldparams.RootLength)

View File

@ -251,7 +251,6 @@ func (s *Service) rejectInvalidSyncAggregateSignature(m *ethpb.SignedContributio
defer span.End()
// The aggregate signature is valid for the message `beacon_block_root` and aggregate pubkey
// derived from the participation info in `aggregation_bits` for the subcommittee specified by the `contribution.subcommittee_index`.
var activePubkeys []bls.PublicKey
var activeRawPubkeys [][]byte
syncPubkeys, err := s.cfg.chain.HeadSyncCommitteePubKeys(ctx, m.Message.Contribution.Slot, primitives.CommitteeIndex(m.Message.Contribution.SubcommitteeIndex))
if err != nil {
@ -265,12 +264,6 @@ func (s *Service) rejectInvalidSyncAggregateSignature(m *ethpb.SignedContributio
}
for i, pk := range syncPubkeys {
if bVector.BitAt(uint64(i)) {
pubK, err := bls.PublicKeyFromBytes(pk)
if err != nil {
tracing.AnnotateError(span, err)
return pubsub.ValidationIgnore, err
}
activePubkeys = append(activePubkeys, pubK)
activeRawPubkeys = append(activeRawPubkeys, pk)
}
}

View File

@ -1,7 +1,6 @@
package attestations
import (
"fmt"
"io"
"sort"
"testing"
@ -226,7 +225,7 @@ func TestAggregateAttestations_Aggregate(t *testing.T) {
assert.DeepEqual(t, w.Bytes(), got[i].AggregationBits.Bytes())
}
}
t.Run(fmt.Sprintf("%s", tt.name), func(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
runner()
})
}

View File

@ -31,7 +31,7 @@ func main() {
}
c := v1alpha1.NewBeaconChainClient(cc)
g, ctx := errgroup.WithContext(ctx)
v := NewVotes()
v := newVotes()
current := slots.ToEpoch(slots.CurrentSlot(*genesis))
start := current.Div(uint64(params.BeaconConfig().EpochsPerEth1VotingPeriod)).Mul(uint64(params.BeaconConfig().EpochsPerEth1VotingPeriod))

View File

@ -20,7 +20,7 @@ type votes struct {
total uint
}
func NewVotes() *votes {
func newVotes() *votes {
return &votes{
hashes: make(map[[32]byte]uint),
roots: make(map[[32]byte]uint),