state

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 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(cfg *config.RocketPoolConfig, 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(cfg *config.RocketPoolConfig, 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(cfg *config.RocketPoolConfig, 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(cfg *config.RocketPoolConfig, 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(cfg *config.RocketPoolConfig, 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 IsRedstoneDeployed

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

Check if Redstone has been deployed

Types

type NetworkState

type NetworkState struct {
	// Network version
	IsHoustonDeployed bool

	// Block / slot for this state
	ElBlockNumber    uint64
	BeaconSlotNumber uint64
	BeaconConfig     beacon.Eth2Config

	// Network details
	NetworkDetails *rpstate.NetworkDetails

	// Node details
	NodeDetails          []rpstate.NativeNodeDetails
	NodeDetailsByAddress map[common.Address]*rpstate.NativeNodeDetails

	// Minipool details
	MinipoolDetails          []rpstate.NativeMinipoolDetails
	MinipoolDetailsByAddress map[common.Address]*rpstate.NativeMinipoolDetails
	MinipoolDetailsByNode    map[common.Address][]*rpstate.NativeMinipoolDetails

	// Validator details
	ValidatorDetails map[types.ValidatorPubkey]beacon.ValidatorStatus

	// Oracle DAO details
	OracleDaoMemberDetails []rpstate.OracleDaoMemberDetails

	// Protocol DAO proposals
	ProtocolDaoProposalDetails []protocol.ProtocolDaoProposalDetails
	// contains filtered or unexported fields
}

func CreateNetworkState

func CreateNetworkState(cfg *config.RocketPoolConfig, rp *rocketpool.RocketPool, ec rocketpool.ExecutionClient, bc beacon.Client, log *log.ColorLogger, slotNumber uint64, beaconConfig beacon.Eth2Config) (*NetworkState, error)

Creates a snapshot of the entire Rocket Pool network state, on both the Execution and Consensus layers

func CreateNetworkStateForNode

func CreateNetworkStateForNode(cfg *config.RocketPoolConfig, rp *rocketpool.RocketPool, ec rocketpool.ExecutionClient, bc beacon.Client, log *log.ColorLogger, slotNumber uint64, beaconConfig beacon.Eth2Config, nodeAddress common.Address, calculateTotalEffectiveStake bool) (*NetworkState, *big.Int, error)

Creates a snapshot of the Rocket Pool network, but only for a single node Also gets the total effective RPL stake of the network for convenience since this is required by several node routines

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

type NetworkStateManager

type NetworkStateManager struct {
	Config       *config.RocketPoolConfig
	Network      cfgtypes.Network
	ChainID      uint
	BeaconConfig beacon.Eth2Config
	// contains filtered or unexported fields
}

func NewNetworkStateManager

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

Jump to

Keyboard shortcuts

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