state

package
v2.0.0-dev2.0...-efbdfda Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAtlasDeployed

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

Check if Atlas has been deployed

func IsHoustonDeployed

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 {
	// 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[beacon.ValidatorPubkey]beacon.ValidatorStatus

	// Oracle DAO details
	OracleDaoMemberDetails []rpstate.OracleDaoMemberDetails

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

func CreateNetworkState

func CreateNetworkState(cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger, slotNumber uint64, beaconConfig beacon.Eth2Config, context context.Context) (*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.SmartNodeConfig, rp *rocketpool.RocketPool, ec eth.IExecutionClient, bc beacon.IBeaconClient, logger *slog.Logger, slotNumber uint64, beaconConfig beacon.Eth2Config, nodeAddress common.Address, calculateTotalEffectiveStake bool, context context.Context) (*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

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

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

func (*NetworkState) GetNodeWeight

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

type NetworkStateManager

type NetworkStateManager struct {
	Config       *config.SmartNodeConfig
	Network      nmc_config.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(context context.Context) (*NetworkState, error)

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

func (*NetworkStateManager) GetHeadStateForNode

func (m *NetworkStateManager) GetHeadStateForNode(context context.Context, 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(context context.Context) (beacon.BeaconBlock, error)

Gets the latest valid block

func (*NetworkStateManager) GetLatestFinalizedBeaconBlock

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

Gets the latest valid finalized block

func (*NetworkStateManager) GetLatestProposedBeaconBlock

func (m *NetworkStateManager) GetLatestProposedBeaconBlock(context context.Context, 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) GetNodeStateForSlot

func (m *NetworkStateManager) GetNodeStateForSlot(context context.Context, nodeAddress common.Address, slotNumber uint64, calculateTotalEffectiveStake bool) (*NetworkState, *big.Int, error)

Get the state of the network for a single node at the provided Beacon slot, along with the total effective RPL stake for the network

func (*NetworkStateManager) GetStateForSlot

func (m *NetworkStateManager) GetStateForSlot(context context.Context, 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