Documentation ¶
Index ¶
- type AttackerCommand
- type AttackerResponse
- type AttestDuty
- type AttestStrategy
- type BeaconBackend
- type BeaconHeaderInfo
- type BeaconResponse
- type BlockStrategy
- type CacheBackend
- type ClientInfo
- type ExecuteBackend
- type ProposerAtts
- func (a ProposerAtts) Dedup() (ProposerAtts, error)
- func (a ProposerAtts) Filter(ctx context.Context, st state.BeaconState) (ProposerAtts, ProposerAtts)
- func (a ProposerAtts) LimitToMaxAttestations() ProposerAtts
- func (a ProposerAtts) SortByProfitability() (ProposerAtts, error)
- func (a ProposerAtts) SortByProfitabilityUsingMaxCover() (ProposerAtts, error)
- type ProposerDuty
- type RewardInfo
- type RoleType
- type ServiceBackend
- type SlotAttestSet
- type SlotBlockSet
- type SlotStrategy
- type Strategy
- type StrategyBackend
- type TotalReward
- type ValidatorAttestSet
- type ValidatorBlockSet
- type ValidatorDataSet
- func (vs *ValidatorDataSet) AddSignedAttestation(slot uint64, pubkey string, attestation *ethpb.Attestation)
- func (vs *ValidatorDataSet) AddSignedBlock(slot uint64, pubkey string, block *ethpb.GenericSignedBeaconBlock)
- func (vs *ValidatorDataSet) AddValidator(index int, pubkey string)
- func (vs *ValidatorDataSet) GetAttestSet(slot uint64) *SlotAttestSet
- func (vs *ValidatorDataSet) GetBlockSet(slot uint64) *SlotBlockSet
- func (vs *ValidatorDataSet) GetValidatorByIndex(index int) *ValidatorInfo
- func (vs *ValidatorDataSet) GetValidatorByPubkey(pubkey string) *ValidatorInfo
- type ValidatorInfo
- type ValidatorStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttackerCommand ¶
type AttackerCommand int
const ( CMD_NULL AttackerCommand = iota CMD_CONTINUE CMD_RETURN CMD_ABORT CMD_SKIP CMD_ROLE_TO_NORMAL // 角色转换为普通节点 CMD_ROLE_TO_ATTACKER // 角色转换为攻击者 CMD_EXIT CMD_UPDATE_STATE )
type AttackerResponse ¶
type AttackerResponse struct { Cmd AttackerCommand `json:"cmd"` Result string `json:"result"` }
type AttestDuty ¶ added in v0.0.23
type AttestDuty struct { Pubkey string `json:"pubkey"` ValidatorIndex string `json:"validator_index"` CommitteeIndex string `json:"committee_index"` CommitteeLength string `json:"committee_length"` CommitteesAtSlot string `json:"committees_at_slot"` ValidatorCommitteeIndex string `json:"validator_committee_index"` Slot string `json:"slot"` }
type AttestStrategy ¶ added in v0.0.23
type BeaconBackend ¶ added in v0.0.23
type BeaconHeaderInfo ¶ added in v0.0.23
type BeaconHeaderInfo struct { Header struct { Message struct { Slot string `json:"slot"` ProposerIndex string `json:"proposer_index"` ParentRoot string `json:"parent_root"` StateRoot string `json:"state_root"` BodyRoot string `json:"body_root"` } `json:"message"` Signature string `json:"signature"` } `json:"header"` Root string `json:"root"` Canonical bool `json:"canonical"` }
type BeaconResponse ¶ added in v0.0.23
type BeaconResponse struct {
Data json.RawMessage `json:"data"`
}
type BlockStrategy ¶ added in v0.0.23
type CacheBackend ¶ added in v0.0.23
type CacheBackend interface { AddSignedAttestation(slot uint64, pubkey string, attestation *ethpb.Attestation) AddSignedBlock(slot uint64, pubkey string, block *ethpb.GenericSignedBeaconBlock) GetAttestSet(slot uint64) *SlotAttestSet GetBlockSet(slot uint64) *SlotBlockSet GetValidatorDataSet() *ValidatorDataSet GetValidatorRole(slot int, valIdx int) RoleType GetValidatorRoleByPubkey(slot int, pubkey string) RoleType }
type ClientInfo ¶
func ToClientInfo ¶
func ToClientInfo(cliInfo string) ClientInfo
type ExecuteBackend ¶ added in v0.0.23
type ProposerAtts ¶ added in v0.0.10
type ProposerAtts []*ethpb.Attestation
func (ProposerAtts) Dedup ¶ added in v0.0.10
func (a ProposerAtts) Dedup() (ProposerAtts, error)
Dedup removes duplicate attestations (ones with the same bits set on). Important: not only exact duplicates are removed, but proper subsets are removed too (their known bits are redundant and are already contained in their supersets).
func (ProposerAtts) Filter ¶ added in v0.0.10
func (a ProposerAtts) Filter(ctx context.Context, st state.BeaconState) (ProposerAtts, ProposerAtts)
Filter separates attestation list into two groups: valid and invalid attestations. The first group passes the all the required checks for attestation to be considered for proposing. And attestations from the second group should be deleted.
func (ProposerAtts) LimitToMaxAttestations ¶ added in v0.0.10
func (a ProposerAtts) LimitToMaxAttestations() ProposerAtts
LimitToMaxAttestations limits attestations to maximum attestations per block.
func (ProposerAtts) SortByProfitability ¶ added in v0.0.10
func (a ProposerAtts) SortByProfitability() (ProposerAtts, error)
SortByProfitability orders attestations by highest slot and by highest aggregation bit count.
func (ProposerAtts) SortByProfitabilityUsingMaxCover ¶ added in v0.0.10
func (a ProposerAtts) SortByProfitabilityUsingMaxCover() (ProposerAtts, error)
SortByProfitabilityUsingMaxCover orders attestations by highest slot and by highest aggregation bit count. Duplicate bits are counted only once, using max-cover algorithm.
type ProposerDuty ¶ added in v0.0.23
type RewardInfo ¶ added in v0.0.23
type RewardInfo struct {
TotalRewards []TotalReward `json:"total_rewards"`
}
type ServiceBackend ¶ added in v0.0.23
type ServiceBackend interface { ExecuteBackend BeaconBackend CacheBackend StrategyBackend }
ServiceBackend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.
type SlotAttestSet ¶ added in v0.0.23
type SlotAttestSet struct {
Attestations map[string]*ethpb.Attestation
}
type SlotBlockSet ¶ added in v0.0.23
type SlotBlockSet struct {
Blocks map[string]*ethpb.GenericSignedBeaconBlock
}
type SlotStrategy ¶ added in v0.0.24
type Strategy ¶ added in v0.0.23
type Strategy struct { Slots []SlotStrategy `json:"slots"` Validators []ValidatorStrategy `json:"validator"` Block BlockStrategy `json:"block"` Attest AttestStrategy `json:"attest"` }
type StrategyBackend ¶ added in v0.0.23
type TotalReward ¶ added in v0.0.23
type ValidatorAttestSet ¶ added in v0.0.23
type ValidatorAttestSet struct {
Attestations map[uint64]*ethpb.Attestation
}
type ValidatorBlockSet ¶ added in v0.0.23
type ValidatorBlockSet struct {
Blocks map[uint64]ethpb.GenericBeaconBlock
}
type ValidatorDataSet ¶ added in v0.0.23
type ValidatorDataSet struct { ValidatorByIndex sync.Map //map[int]*ValidatorInfo ValidatorByPubkey sync.Map //map[string]*ValidatorInfo AttestSet map[uint64]*SlotAttestSet // epoch -> attestation BlockSet map[uint64]*SlotBlockSet // epoch -> block // contains filtered or unexported fields }
func NewValidatorSet ¶ added in v0.0.23
func NewValidatorSet() *ValidatorDataSet
func (*ValidatorDataSet) AddSignedAttestation ¶ added in v0.0.23
func (vs *ValidatorDataSet) AddSignedAttestation(slot uint64, pubkey string, attestation *ethpb.Attestation)
func (*ValidatorDataSet) AddSignedBlock ¶ added in v0.0.23
func (vs *ValidatorDataSet) AddSignedBlock(slot uint64, pubkey string, block *ethpb.GenericSignedBeaconBlock)
func (*ValidatorDataSet) AddValidator ¶ added in v0.0.23
func (vs *ValidatorDataSet) AddValidator(index int, pubkey string)
func (*ValidatorDataSet) GetAttestSet ¶ added in v0.0.23
func (vs *ValidatorDataSet) GetAttestSet(slot uint64) *SlotAttestSet
func (*ValidatorDataSet) GetBlockSet ¶ added in v0.0.23
func (vs *ValidatorDataSet) GetBlockSet(slot uint64) *SlotBlockSet
func (*ValidatorDataSet) GetValidatorByIndex ¶ added in v0.0.23
func (vs *ValidatorDataSet) GetValidatorByIndex(index int) *ValidatorInfo
func (*ValidatorDataSet) GetValidatorByPubkey ¶ added in v0.0.23
func (vs *ValidatorDataSet) GetValidatorByPubkey(pubkey string) *ValidatorInfo