Skip to content

Commit

Permalink
Remove aggregate pubkey root
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrun5 committed Jan 5, 2024
1 parent 39c678f commit 08022b6
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions chains/evm/prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (p *Prover) RotateArgs(epoch uint64) (*RotateArgs, error) {
}
update := updates[0]

finalizedNextSyncCommitteeBranch := make([][32]byte, len(update.NextSyncCommitteeBranch)+1)
finalizedNextSyncCommitteeBranch := make([][32]byte, len(update.NextSyncCommitteeBranch))
blockRoot, err := p.beaconClient.BeaconBlockRoot(context.Background(), &api.BeaconBlockRootOpts{
Block: fmt.Sprint(update.FinalizedHeader.Header.Slot),
})
Expand All @@ -231,15 +231,10 @@ func (p *Prover) RotateArgs(epoch uint64) (*RotateArgs, error) {
if err != nil {
return nil, err
}
copy(finalizedNextSyncCommitteeBranch[1:], bootstrap.CurrentSyncCommitteeBranch)

aggregatePubkeyRoot, err := p.aggregatePubkeyRoot(update.NextSyncCommittee.AggregatePubKey)
if err != nil {
return nil, err
}
finalizedNextSyncCommitteeBranch[0] = aggregatePubkeyRoot
finalizedNextSyncCommitteeBranch[1] = update.NextSyncCommitteeBranch[0]
update.NextSyncCommitteeBranch = bootstrap.CurrentSyncCommitteeBranch
copy(finalizedNextSyncCommitteeBranch, bootstrap.CurrentSyncCommitteeBranch)
finalizedNextSyncCommitteeBranch[0] = update.NextSyncCommitteeBranch[0]
update.NextSyncCommitteeBranch = finalizedNextSyncCommitteeBranch

domain, err := p.beaconClient.Domain(context.Background(), SYNC_COMMITTEE_DOMAIN, phase0.Epoch(update.FinalizedHeader.Header.Slot/32))
if err != nil {
Expand Down Expand Up @@ -271,11 +266,3 @@ func (p *Prover) pubkeysRoot(pubkeys [512][48]byte) ([32]byte, error) {
h.Merkleize(subIndx)
return h.HashRoot()
}

func (p *Prover) aggregatePubkeyRoot(pubkey [48]byte) ([32]byte, error) {
h := ssz.NewHasher()
subIndx := h.Index()
h.PutBytes(pubkey[:])
h.Merkleize(subIndx)
return h.HashRoot()
}

0 comments on commit 08022b6

Please sign in to comment.