Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type Database
- func (db *Database) AddValidator(pubkey beacon.ValidatorPubkey, withdrawalCredentials common.Hash) (*Validator, error)
- func (db *Database) Clone() *Database
- func (db *Database) CommitBlock(slotValidated bool)
- func (db *Database) GetAllValidators() []*Validator
- func (db *Database) GetCurrentSlot() uint64
- func (db *Database) GetHighestSlot() uint64
- func (db *Database) GetValidatorByIndex(index uint) *Validator
- func (db *Database) GetValidatorByPubkey(pubkey beacon.ValidatorPubkey) *Validator
- func (db *Database) SetHighestSlot(slot uint64)
- type Validator
Constants ¶
const ( DefaultChainID uint64 = 0x90de5e7 DefaultDepositContractAddressString string = "0xde905175eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" )
const ( FarFutureEpoch uint64 = 0xffffffffffffffff StartingBalance uint64 = 32e9 )
Variables ¶
var ( // Default config DefaultDepositContractAddress common.Address = common.HexToAddress(DefaultDepositContractAddressString) )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Basic settings ChainID uint64 `json:"chainID" yaml:"chainID"` SecondsPerSlot uint64 `json:"secondsPerSlot" yaml:"secondsPerSlot"` SlotsPerEpoch uint64 `json:"slotsPerEpoch" yaml:"slotsPerEpoch"` EpochsPerSyncCommitteePeriod uint64 `json:"epochsPerSyncCommitteePeriod" yaml:"epochsPerSyncCommitteePeriod"` DepositContract common.Address `json:"depositContract" yaml:"depositContract"` // Genesis info GenesisTime time.Time `json:"genesisTime,omitempty" yaml:"genesisTime,omitempty"` GenesisForkVersion utils.ByteArray `json:"genesisForkVersion" yaml:"genesisForkVersion"` GenesisValidatorsRoot utils.ByteArray `json:"genesisValidatorsRoot" yaml:"genesisValidatorsRoot"` // Altair info AltairForkVersion utils.ByteArray `json:"altairForkVersion" yaml:"altairForkVersion"` AltairForkEpoch uint64 `json:"altairForkEpoch" yaml:"altairForkEpoch"` // Bellatrix info BellatrixForkVersion utils.ByteArray `json:"bellatrixForkVersion" yaml:"bellatrixForkVersion"` BellatrixForkEpoch uint64 `json:"bellatrixForkEpoch" yaml:"bellatrixForkEpoch"` // Capella info CapellaForkVersion utils.ByteArray `json:"capellaForkVersion" yaml:"capellaForkVersion"` CapellaForkEpoch uint64 `json:"capellaForkEpoch" yaml:"capellaForkEpoch"` // Deneb info DenebForkVersion utils.ByteArray `json:"denebForkVersion" yaml:"denebForkVersion"` DenebForkEpoch uint64 `json:"denebForkEpoch" yaml:"denebForkEpoch"` // The index of the first execution layer block to be linked to in a Beacon chain slot FirstExecutionBlockIndex uint64 }
Basic Beacon Chain configuration
func LoadFromFile ¶ added in v0.3.0
Creates a new config instance from a file
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Beacon mock database
func NewDatabase ¶
Create a new database instance
func (*Database) AddValidator ¶
func (db *Database) AddValidator(pubkey beacon.ValidatorPubkey, withdrawalCredentials common.Hash) (*Validator, error)
Add a new validator to the database. Returns an error if the validator already exists.
func (*Database) CommitBlock ¶
Add a new block to the chain. Set slotValidated to true to "propose a block" for the current slot, linking it to the next Execution block's index. Set it to false to "miss" the slot, so there was not block proposed for it.
func (*Database) GetAllValidators ¶
Get all validators
func (*Database) GetCurrentSlot ¶
Get the latest local head slot
func (*Database) GetHighestSlot ¶
Get the highest slot on the chain (the actual chain head)
func (*Database) GetValidatorByIndex ¶
Get a validator by its index. Returns nil if it doesn't exist.
func (*Database) GetValidatorByPubkey ¶
func (db *Database) GetValidatorByPubkey(pubkey beacon.ValidatorPubkey) *Validator
Get a validator by its pubkey. Returns nil if it doesn't exist.
func (*Database) SetHighestSlot ¶
Set the highest slot on the chain - useful for simulating syncing conditions
type Validator ¶
type Validator struct { Pubkey beacon.ValidatorPubkey Index uint64 WithdrawalCredentials common.Hash Balance uint64 Status beacon.ValidatorState EffectiveBalance uint64 Slashed bool ActivationEligibilityEpoch uint64 ActivationEpoch uint64 ExitEpoch uint64 WithdrawableEpoch uint64 }
func NewValidator ¶
func (*Validator) GetValidatorMeta ¶
func (*Validator) SetBalance ¶
func (*Validator) SetStatus ¶
func (v *Validator) SetStatus(status beacon.ValidatorState)