Documentation
¶
Overview ¶
Package iface defines the actual beacon state interface used by a Prysm beacon node, also containing useful, scoped interfaces such as a ReadOnlyState and WriteOnlyBeaconState.
Index ¶
- type BeaconState
- type BeaconStateAltair
- type FutureForkStub
- type ReadOnlyAttestations
- type ReadOnlyBalances
- type ReadOnlyBeaconState
- type ReadOnlyBlockRoots
- type ReadOnlyCheckpoint
- type ReadOnlyEth1Data
- type ReadOnlyRandaoMixes
- type ReadOnlyStateRoots
- type ReadOnlyValidator
- type ReadOnlyValidators
- type WriteOnlyAttestations
- type WriteOnlyBalances
- type WriteOnlyBeaconState
- type WriteOnlyBlockRoots
- type WriteOnlyCheckpoint
- type WriteOnlyEth1Data
- type WriteOnlyRandaoMixes
- type WriteOnlyStateRoots
- type WriteOnlyValidators
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeaconState ¶
type BeaconState interface { ReadOnlyBeaconState WriteOnlyBeaconState Copy() BeaconState HashTreeRoot(ctx context.Context) ([32]byte, error) ToProto() (*v1.BeaconState, error) Version() int FutureForkStub }
BeaconState has read and write access to beacon state methods.
type BeaconStateAltair ¶ added in v1.4.1
type BeaconStateAltair interface { BeaconState CurrentSyncCommittee() (*pbp2p.SyncCommittee, error) NextSyncCommittee() (*pbp2p.SyncCommittee, error) SetCurrentSyncCommittee(val *pbp2p.SyncCommittee) error SetNextSyncCommittee(val *pbp2p.SyncCommittee) error CurrentEpochParticipation() ([]byte, error) PreviousEpochParticipation() ([]byte, error) InactivityScores() ([]uint64, error) AppendCurrentParticipationBits(val byte) error AppendPreviousParticipationBits(val byte) error AppendInactivityScore(s uint64) error SetInactivityScores(val []uint64) error SetPreviousParticipationBits(val []byte) error SetCurrentParticipationBits(val []byte) error }
BeaconStateAltair has read and write access to beacon state methods.
type FutureForkStub ¶ added in v1.4.1
type FutureForkStub interface { AppendCurrentParticipationBits(val byte) error AppendPreviousParticipationBits(val byte) error AppendInactivityScore(s uint64) error CurrentEpochParticipation() ([]byte, error) PreviousEpochParticipation() ([]byte, error) InactivityScores() ([]uint64, error) SetInactivityScores(val []uint64) error CurrentSyncCommittee() (*pbp2p.SyncCommittee, error) SetCurrentSyncCommittee(val *pbp2p.SyncCommittee) error SetPreviousParticipationBits(val []byte) error SetCurrentParticipationBits(val []byte) error NextSyncCommittee() (*pbp2p.SyncCommittee, error) SetNextSyncCommittee(val *pbp2p.SyncCommittee) error }
FutureForkStub defines methods that are used for future forks. This is a low cost solution to enable various state casting of interface to work.
type ReadOnlyAttestations ¶
type ReadOnlyAttestations interface { PreviousEpochAttestations() ([]*pbp2p.PendingAttestation, error) CurrentEpochAttestations() ([]*pbp2p.PendingAttestation, error) }
ReadOnlyAttestations defines a struct which only has read access to attestations methods.
type ReadOnlyBalances ¶
type ReadOnlyBalances interface { Balances() []uint64 BalanceAtIndex(idx types.ValidatorIndex) (uint64, error) BalancesLength() int }
ReadOnlyBalances defines a struct which only has read access to balances methods.
type ReadOnlyBeaconState ¶
type ReadOnlyBeaconState interface { ReadOnlyBlockRoots ReadOnlyStateRoots ReadOnlyRandaoMixes ReadOnlyEth1Data ReadOnlyValidators ReadOnlyBalances ReadOnlyCheckpoint ReadOnlyAttestations InnerStateUnsafe() interface{} CloneInnerState() interface{} GenesisTime() uint64 GenesisValidatorRoot() []byte Slot() types.Slot Fork() *pbp2p.Fork LatestBlockHeader() *ethpb.BeaconBlockHeader HistoricalRoots() [][]byte Slashings() []uint64 FieldReferencesCount() map[string]uint64 MarshalSSZ() ([]byte, error) IsNil() bool }
ReadOnlyBeaconState defines a struct which only has read access to beacon state methods.
type ReadOnlyBlockRoots ¶
type ReadOnlyBlockRoots interface { BlockRoots() [][]byte BlockRootAtIndex(idx uint64) ([]byte, error) }
ReadOnlyBlockRoots defines a struct which only has read access to block roots methods.
type ReadOnlyCheckpoint ¶
type ReadOnlyCheckpoint interface { PreviousJustifiedCheckpoint() *ethpb.Checkpoint CurrentJustifiedCheckpoint() *ethpb.Checkpoint MatchCurrentJustifiedCheckpoint(c *ethpb.Checkpoint) bool MatchPreviousJustifiedCheckpoint(c *ethpb.Checkpoint) bool FinalizedCheckpoint() *ethpb.Checkpoint FinalizedCheckpointEpoch() types.Epoch JustificationBits() bitfield.Bitvector4 }
ReadOnlyCheckpoint defines a struct which only has read access to checkpoint methods.
type ReadOnlyEth1Data ¶
type ReadOnlyEth1Data interface { Eth1Data() *ethpb.Eth1Data Eth1DataVotes() []*ethpb.Eth1Data Eth1DepositIndex() uint64 }
ReadOnlyEth1Data defines a struct which only has read access to eth1 data methods.
type ReadOnlyRandaoMixes ¶
type ReadOnlyRandaoMixes interface { RandaoMixes() [][]byte RandaoMixAtIndex(idx uint64) ([]byte, error) RandaoMixesLength() int }
ReadOnlyRandaoMixes defines a struct which only has read access to randao mixes methods.
type ReadOnlyStateRoots ¶
type ReadOnlyStateRoots interface { StateRoots() [][]byte StateRootAtIndex(idx uint64) ([]byte, error) }
ReadOnlyStateRoots defines a struct which only has read access to state roots methods.
type ReadOnlyValidator ¶
type ReadOnlyValidator interface { EffectiveBalance() uint64 ActivationEligibilityEpoch() types.Epoch ActivationEpoch() types.Epoch WithdrawableEpoch() types.Epoch ExitEpoch() types.Epoch PublicKey() [48]byte WithdrawalCredentials() []byte Slashed() bool IsNil() bool }
ReadOnlyValidator defines a struct which only has read access to validator methods.
type ReadOnlyValidators ¶
type ReadOnlyValidators interface { Validators() []*ethpb.Validator ValidatorAtIndex(idx types.ValidatorIndex) (*ethpb.Validator, error) ValidatorAtIndexReadOnly(idx types.ValidatorIndex) (ReadOnlyValidator, error) ValidatorIndexByPubkey(key [48]byte) (types.ValidatorIndex, bool) PubkeyAtIndex(idx types.ValidatorIndex) [48]byte NumValidators() int ReadFromEveryValidator(f func(idx int, val ReadOnlyValidator) error) error }
ReadOnlyValidators defines a struct which only has read access to validators methods.
type WriteOnlyAttestations ¶
type WriteOnlyAttestations interface { AppendCurrentEpochAttestations(val *pbp2p.PendingAttestation) error AppendPreviousEpochAttestations(val *pbp2p.PendingAttestation) error RotateAttestations() error }
WriteOnlyAttestations defines a struct which only has write access to attestations methods.
type WriteOnlyBalances ¶
type WriteOnlyBalances interface { SetBalances(val []uint64) error UpdateBalancesAtIndex(idx types.ValidatorIndex, val uint64) error AppendBalance(bal uint64) error }
WriteOnlyBalances defines a struct which only has write access to balances methods.
type WriteOnlyBeaconState ¶
type WriteOnlyBeaconState interface { WriteOnlyBlockRoots WriteOnlyStateRoots WriteOnlyRandaoMixes WriteOnlyEth1Data WriteOnlyValidators WriteOnlyBalances WriteOnlyCheckpoint WriteOnlyAttestations SetGenesisTime(val uint64) error SetGenesisValidatorRoot(val []byte) error SetSlot(val types.Slot) error SetFork(val *pbp2p.Fork) error SetLatestBlockHeader(val *ethpb.BeaconBlockHeader) error SetHistoricalRoots(val [][]byte) error SetSlashings(val []uint64) error UpdateSlashingsAtIndex(idx, val uint64) error AppendHistoricalRoots(root [32]byte) error }
WriteOnlyBeaconState defines a struct which only has write access to beacon state methods.
type WriteOnlyBlockRoots ¶
type WriteOnlyBlockRoots interface { SetBlockRoots(val [][]byte) error UpdateBlockRootAtIndex(idx uint64, blockRoot [32]byte) error }
WriteOnlyBlockRoots defines a struct which only has write access to block roots methods.
type WriteOnlyCheckpoint ¶
type WriteOnlyCheckpoint interface { SetFinalizedCheckpoint(val *ethpb.Checkpoint) error SetPreviousJustifiedCheckpoint(val *ethpb.Checkpoint) error SetCurrentJustifiedCheckpoint(val *ethpb.Checkpoint) error SetJustificationBits(val bitfield.Bitvector4) error }
WriteOnlyCheckpoint defines a struct which only has write access to check point methods.
type WriteOnlyEth1Data ¶
type WriteOnlyEth1Data interface { SetEth1Data(val *ethpb.Eth1Data) error SetEth1DataVotes(val []*ethpb.Eth1Data) error AppendEth1DataVotes(val *ethpb.Eth1Data) error SetEth1DepositIndex(val uint64) error }
WriteOnlyEth1Data defines a struct which only has write access to eth1 data methods.
type WriteOnlyRandaoMixes ¶
type WriteOnlyRandaoMixes interface { SetRandaoMixes(val [][]byte) error UpdateRandaoMixesAtIndex(idx uint64, val []byte) error }
WriteOnlyRandaoMixes defines a struct which only has write access to randao mixes methods.
type WriteOnlyStateRoots ¶
type WriteOnlyStateRoots interface { SetStateRoots(val [][]byte) error UpdateStateRootAtIndex(idx uint64, stateRoot [32]byte) error }
WriteOnlyStateRoots defines a struct which only has write access to state roots methods.
type WriteOnlyValidators ¶
type WriteOnlyValidators interface { SetValidators(val []*ethpb.Validator) error ApplyToEveryValidator(f func(idx int, val *ethpb.Validator) (bool, *ethpb.Validator, error)) error UpdateValidatorAtIndex(idx types.ValidatorIndex, val *ethpb.Validator) error AppendValidator(val *ethpb.Validator) error }
WriteOnlyValidators defines a struct which only has write access to validators methods.