state

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClaimIntervalTime

func GetClaimIntervalTime(index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (time.Duration, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetNodeOperatorRewardsPercent

func GetNodeOperatorRewardsPercent(index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetPendingRPLRewards

func GetPendingRPLRewards(index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetProtocolDaoRewardsPercent

func GetProtocolDaoRewardsPercent(index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetTrustedNodeOperatorRewardsPercent

func GetTrustedNodeOperatorRewardsPercent(index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func IsAtlasDeployed

func IsAtlasDeployed(rp *rocketpool.RocketPool, opts *bind.CallOpts) (bool, error)

Check if Atlas has been deployed

func IsHoustonDeployed added in v1.13.0

func IsHoustonDeployed(rp *rocketpool.RocketPool, opts *bind.CallOpts) (bool, error)

Check if Houston has been deployed

func IsHoustonHotfixDeployed added in v1.13.8

func IsHoustonHotfixDeployed(rp *rocketpool.RocketPool, opts *bind.CallOpts) (bool, error)

Check if Houston Hotfix has been deployed

func IsRedstoneDeployed

func IsRedstoneDeployed(rp *rocketpool.RocketPool, opts *bind.CallOpts) (bool, error)

Check if Redstone has been deployed

Types

type CriticalDutiesEpochs added in v1.15.0

type CriticalDutiesEpochs struct {
	// Map of epoch uint64 to a list of validator indices
	CriticalDuties map[uint64][]string
}

func NewCriticalDutiesEpochs added in v1.15.0

func NewCriticalDutiesEpochs(epochs uint64, state *NetworkState) *CriticalDutiesEpochs

Gets the critical duties slots for a given state as if it were the final state in a epochs epoch interval

type CriticalDutiesSlots added in v1.15.0

type CriticalDutiesSlots struct {
	// Map of validator index to a list of critical duties slots
	CriticalDuties map[string][]uint64
}

func NewCriticalDutiesSlots added in v1.15.0

func NewCriticalDutiesSlots(criticalDutiesEpochs *CriticalDutiesEpochs, bc beacon.Client) (*CriticalDutiesSlots, error)

For each validator in criticalDutiesEpochs, map the epochs to the slot the attestation duty assignment was for

type NetworkState

type NetworkState struct {

	// Block / slot for this state
	ElBlockNumber    uint64            `json:"el_block_number"`
	BeaconSlotNumber uint64            `json:"beacon_slot_number"`
	BeaconConfig     beacon.Eth2Config `json:"beacon_config"`

	// Network details
	NetworkDetails *rpstate.NetworkDetails `json:"network_details"`

	// Node details
	NodeDetails []rpstate.NativeNodeDetails `json:"node_details"`
	// NodeDetailsByAddress is an index over NodeDetails and is ignored when marshaling to JSON
	// it is rebuilt when unmarshaling from JSON.
	NodeDetailsByAddress map[common.Address]*rpstate.NativeNodeDetails `json:"-"`

	// Minipool details
	MinipoolDetails []rpstate.NativeMinipoolDetails `json:"minipool_details"`
	// These next two fields are indexes over MinipoolDetails and are ignored when marshaling to JSON
	// they are rebuilt when unmarshaling from JSON.
	MinipoolDetailsByAddress map[common.Address]*rpstate.NativeMinipoolDetails   `json:"-"`
	MinipoolDetailsByNode    map[common.Address][]*rpstate.NativeMinipoolDetails `json:"-"`

	// Validator details
	ValidatorDetails ValidatorDetailsMap `json:"validator_details"`

	// Oracle DAO details
	OracleDaoMemberDetails []rpstate.OracleDaoMemberDetails `json:"oracle_dao_member_details"`

	// Protocol DAO proposals
	ProtocolDaoProposalDetails []protocol.ProtocolDaoProposalDetails `json:"protocol_dao_proposal_details,omitempty"`
	// contains filtered or unexported fields
}

func (*NetworkState) CalculateNodeWeights added in v1.11.3

func (s *NetworkState) CalculateNodeWeights() (map[common.Address]*big.Int, *big.Int, error)

Starting in v8, RPL stake is phased out and replaced with weight. scaleByParticipation and allowRplForUnstartedValidators are hard-coded true here, since only v8 cares about weight.

func (*NetworkState) CalculateTrueEffectiveStakes

func (s *NetworkState) CalculateTrueEffectiveStakes(scaleByParticipation bool, allowRplForUnstartedValidators bool) (map[common.Address]*big.Int, *big.Int, error)

Calculate the true effective stakes of all nodes in the state, using the validator status on Beacon as a reference for minipool eligibility instead of the EL-based minipool status

func (*NetworkState) GetEligibleBorrowedEth added in v1.12.0

func (s *NetworkState) GetEligibleBorrowedEth(node *rpstate.NativeNodeDetails) *big.Int

func (*NetworkState) GetNodeWeight added in v1.12.0

func (s *NetworkState) GetNodeWeight(eligibleBorrowedEth *big.Int, nodeStake *big.Int) *big.Int

func (*NetworkState) GetStakedRplValueInEthAndPercentOfBorrowedEth added in v1.15.0

func (s *NetworkState) GetStakedRplValueInEthAndPercentOfBorrowedEth(eligibleBorrowedEth *big.Int, nodeStake *big.Int) (*big.Int, *big.Int)

func (NetworkState) MarshalJSON added in v1.15.0

func (ns NetworkState) MarshalJSON() ([]byte, error)

func (*NetworkState) UnmarshalJSON added in v1.15.0

func (ns *NetworkState) UnmarshalJSON(data []byte) error

type NetworkStateManager

type NetworkStateManager struct {
	// contains filtered or unexported fields
}

func NewNetworkStateManager

func NewNetworkStateManager(
	rp *rocketpool.RocketPool,
	contracts config.StateManagerContracts,
	bc beacon.Client,
	log *log.ColorLogger,
) *NetworkStateManager

Create a new manager for the network state

func (*NetworkStateManager) GetHeadSlot

func (m *NetworkStateManager) GetHeadSlot() (uint64, error)

Gets the Beacon slot for the latest execution layer block

func (*NetworkStateManager) GetHeadState

func (m *NetworkStateManager) GetHeadState() (*NetworkState, error)

Get the state of the network using the latest Execution layer block

func (*NetworkStateManager) GetHeadStateForNode

func (m *NetworkStateManager) GetHeadStateForNode(nodeAddress common.Address, calculateTotalEffectiveStake bool) (*NetworkState, *big.Int, error)

Get the state of the network for a single node using the latest Execution layer block, along with the total effective RPL stake for the network

func (*NetworkStateManager) GetLatestBeaconBlock

func (m *NetworkStateManager) GetLatestBeaconBlock() (beacon.BeaconBlock, error)

Gets the latest valid block

func (*NetworkStateManager) GetLatestFinalizedBeaconBlock

func (m *NetworkStateManager) GetLatestFinalizedBeaconBlock() (beacon.BeaconBlock, error)

Gets the latest valid finalized block

func (*NetworkStateManager) GetLatestProposedBeaconBlock added in v1.10.0

func (m *NetworkStateManager) GetLatestProposedBeaconBlock(targetSlot uint64) (beacon.BeaconBlock, error)

Gets the target Beacon block, or if it was missing, the first one under it that wasn't missing

func (*NetworkStateManager) GetStateForSlot

func (m *NetworkStateManager) GetStateForSlot(slotNumber uint64) (*NetworkState, error)

Get the state of the network at the provided Beacon slot

type ValidatorDetailsMap added in v1.15.0

type ValidatorDetailsMap map[types.ValidatorPubkey]beacon.ValidatorStatus

func (ValidatorDetailsMap) MarshalJSON added in v1.15.0

func (vdm ValidatorDetailsMap) MarshalJSON() ([]byte, error)

func (*ValidatorDetailsMap) UnmarshalJSON added in v1.15.0

func (vdm *ValidatorDetailsMap) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL