From 1a741325efdd95b5686674d542140725c9fd81f1 Mon Sep 17 00:00:00 2001 From: mpetrun5 Date: Fri, 5 Jan 2024 14:40:24 +0100 Subject: [PATCH] Set 0 as aggregate pubkey root --- chains/evm/prover/prover.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/chains/evm/prover/prover.go b/chains/evm/prover/prover.go index 49f4b83..379a0ce 100644 --- a/chains/evm/prover/prover.go +++ b/chains/evm/prover/prover.go @@ -233,7 +233,7 @@ func (p *Prover) RotateArgs(epoch uint64) (*RotateArgs, error) { } copy(finalizedNextSyncCommitteeBranch[1:], bootstrap.CurrentSyncCommitteeBranch) - finalizedNextSyncCommitteeBranch[0] = update.NextSyncCommitteeBranch[0] + finalizedNextSyncCommitteeBranch[0] = p.aggregatePubkeyRoot(update.NextSyncCommittee.AggregatePubKey) finalizedNextSyncCommitteeBranch[1] = update.NextSyncCommitteeBranch[1] update.NextSyncCommitteeBranch = bootstrap.CurrentSyncCommitteeBranch @@ -267,3 +267,10 @@ 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() \ No newline at end of file