mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
* Add the new Fulu state with the new field * fix the hasher for the fulu state * Fix ToProto() and ToProtoUnsafe() * Add the fields as shared * Add epoch transition code * short circuit the proposer cache to use the state * Marshal the state JSON * update spectests to 1.6.0-alpha.1 * Remove deneb and electra entries from blob schedule This was cherry picked from PR #15364 and edited to remove the minimal cases * Fix minimal tests * Increase deadling for processing blocks in spectests * Preston's review * review --------- Co-authored-by: terence tsao <terence@prysmaticlabs.com>
31 lines
1.0 KiB
Go
31 lines
1.0 KiB
Go
package state_native
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native/types"
|
|
"github.com/OffchainLabs/prysm/v6/beacon-chain/state/stateutil"
|
|
"github.com/OffchainLabs/prysm/v6/config/params"
|
|
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
|
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
|
)
|
|
|
|
// SetProposerLookahead is a mutating call to the beacon state which sets the proposer lookahead
|
|
func (b *BeaconState) SetProposerLookahead(lookahead []primitives.ValidatorIndex) error {
|
|
if b.version < version.Fulu {
|
|
return errNotSupported("SetProposerLookahead", b.version)
|
|
}
|
|
if len(lookahead) != int((params.BeaconConfig().MinSeedLookahead+1))*int(params.BeaconConfig().SlotsPerEpoch) {
|
|
return errors.New("invalid size for proposer lookahead")
|
|
}
|
|
b.lock.Lock()
|
|
defer b.lock.Unlock()
|
|
b.sharedFieldReferences[types.ProposerLookahead].MinusRef()
|
|
b.sharedFieldReferences[types.ProposerLookahead] = stateutil.NewRef(1)
|
|
|
|
b.proposerLookahead = lookahead
|
|
|
|
b.markFieldAsDirty(types.ProposerLookahead)
|
|
return nil
|
|
}
|