mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
19 lines
561 B
Go
19 lines
561 B
Go
package stateutil
|
|
|
|
import (
|
|
"encoding/binary"
|
|
|
|
"github.com/OffchainLabs/prysm/v7/consensus-types/primitives"
|
|
"github.com/OffchainLabs/prysm/v7/encoding/ssz"
|
|
)
|
|
|
|
// ProposerLookaheadRoot computes the hash tree root of the proposer lookahead
|
|
func ProposerLookaheadRoot(lookahead []primitives.ValidatorIndex) ([32]byte, error) {
|
|
chunks := make([][32]byte, (len(lookahead)*8+31)/32)
|
|
for i, idx := range lookahead {
|
|
j := i / 4
|
|
binary.LittleEndian.PutUint64(chunks[j][(i%4)*8:], uint64(idx))
|
|
}
|
|
return ssz.MerkleizeVector(chunks, uint64(len(chunks))), nil
|
|
}
|