mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-05-11 03:01:36 -04:00
This adds the PTC cache to the Gloas proto and native beacon state, updates SSZ/hash-tree-root handling, initializes the cache on Gloas upgrade, rotates it during epoch processing, and switches payload committee lookups to read from the cached window instead of recomputing PTC assignments on demand Reference: https://github.com/ethereum/consensus-specs/pull/4979
25 lines
768 B
Go
25 lines
768 B
Go
package util
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/gloas"
|
|
"github.com/OffchainLabs/prysm/v7/beacon-chain/state"
|
|
"github.com/OffchainLabs/prysm/v7/crypto/bls"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// DeterministicGenesisStateGloas returns a genesis state in Gloas format made
|
|
// using the deterministic deposits.
|
|
func DeterministicGenesisStateGloas(t testing.TB, numValidators uint64) (state.BeaconState, []bls.SecretKey) {
|
|
t.Helper()
|
|
|
|
fuluState, privKeys := DeterministicGenesisStateFulu(t, numValidators)
|
|
beaconState, err := gloas.UpgradeToGloas(fuluState)
|
|
if err != nil {
|
|
t.Fatal(errors.Wrapf(err, "failed to upgrade genesis beacon state of %d validators to gloas", numValidators))
|
|
}
|
|
resetCache()
|
|
return beaconState, privKeys
|
|
}
|