rewards

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: GPL-3.0 Imports: 39 Imported by: 3

Documentation

Overview

Experimenting with an alternate language style - named return params

Index

Constants

View Source
const (
	SmoothingPoolDetailsBatchSize uint64 = 8
	TestingInterval               uint64 = 1000000000 // A large number that won't ever actually be hit

	// Mainnet intervals
	MainnetV2Interval uint64 = 4
	MainnetV3Interval uint64 = 5
	MainnetV4Interval uint64 = 6
	MainnetV5Interval uint64 = 8

	// Prater intervals
	PraterV2Interval uint64 = 37
	PraterV3Interval uint64 = 49
	PraterV4Interval uint64 = 60
	PraterV5Interval uint64 = 76
)

Settings

View Source
const (
	FarEpoch uint64 = 18446744073709551615
)

Variables

This section is empty.

Functions

func DownloadRewardsFile

func DownloadRewardsFile(cfg *config.RocketPoolConfig, interval uint64, cid string, isDaemon bool) error

Downloads a single rewards file

func GetClaimStatus

func GetClaimStatus(rp *rocketpool.RocketPool, nodeAddress common.Address) (unclaimed []uint64, claimed []uint64, err error)

Gets the intervals the node can claim and the intervals that have already been claimed

func GetELBlockHeaderForTime

func GetELBlockHeaderForTime(targetTime time.Time, rp *rocketpool.RocketPool) (*types.Header, error)

Get the number of the latest EL block that was created before the given timestamp

func GetRewardSnapshotEvent added in v1.6.2

func GetRewardSnapshotEvent(rp *rocketpool.RocketPool, cfg *config.RocketPoolConfig, interval uint64) (rewards.RewardsEvent, error)

Get the event for a rewards snapshot

func GetUpgradedRewardSnapshotEvent

func GetUpgradedRewardSnapshotEvent(cfg *config.RocketPoolConfig, rp *rocketpool.RocketPool, index uint64, intervalSize *big.Int, startBlock *big.Int, endBlock *big.Int) (rewards.RewardsEvent, error)

This retrieves the rewards snapshot event from a set of contracts, upgrading it to the latest struct version

Types

type CommitteeInfo

type CommitteeInfo struct {
	Index     uint64
	Positions map[int]*MinipoolInfo
}

type IntervalDutiesInfo

type IntervalDutiesInfo struct {
	Index uint64
	Slots map[uint64]*SlotInfo
}

type IntervalInfo

type IntervalInfo struct {
	Index                  uint64        `json:"index"`
	TreeFilePath           string        `json:"treeFilePath"`
	TreeFileExists         bool          `json:"treeFileExists"`
	MerkleRootValid        bool          `json:"merkleRootValid"`
	CID                    string        `json:"cid"`
	StartTime              time.Time     `json:"startTime"`
	EndTime                time.Time     `json:"endTime"`
	NodeExists             bool          `json:"nodeExists"`
	CollateralRplAmount    *QuotedBigInt `json:"collateralRplAmount"`
	ODaoRplAmount          *QuotedBigInt `json:"oDaoRplAmount"`
	SmoothingPoolEthAmount *QuotedBigInt `json:"smoothingPoolEthAmount"`
	MerkleProof            []common.Hash `json:"merkleProof"`
}

Information about an interval

func GetIntervalInfo

func GetIntervalInfo(rp *rocketpool.RocketPool, cfg *config.RocketPoolConfig, nodeAddress common.Address, interval uint64) (info IntervalInfo, err error)

Gets the information for an interval including the file status, the validity, and the node's rewards

type MinipoolInfo

type MinipoolInfo struct {
	Address                 common.Address
	ValidatorPubkey         types.ValidatorPubkey
	ValidatorIndex          uint64
	NodeAddress             common.Address
	NodeIndex               uint64
	Fee                     *big.Int
	MissedAttestations      uint64
	GoodAttestations        uint64
	MinipoolShare           *big.Int
	MissingAttestationSlots map[uint64]bool
	WasActive               bool
	StartSlot               uint64
	EndSlot                 uint64
	AttestationScore        *big.Int
	CompletedAttestations   map[uint64]bool
}

type MinipoolPerformanceFile

type MinipoolPerformanceFile struct {
	Index               uint64                                               `json:"index"`
	Network             string                                               `json:"network"`
	StartTime           time.Time                                            `json:"startTime,omitempty"`
	EndTime             time.Time                                            `json:"endTime,omitempty"`
	ConsensusStartBlock uint64                                               `json:"consensusStartBlock,omitempty"`
	ConsensusEndBlock   uint64                                               `json:"consensusEndBlock,omitempty"`
	ExecutionStartBlock uint64                                               `json:"executionStartBlock,omitempty"`
	ExecutionEndBlock   uint64                                               `json:"executionEndBlock,omitempty"`
	MinipoolPerformance map[common.Address]*SmoothingPoolMinipoolPerformance `json:"minipoolPerformance"`
}

Holds information

type NetworkRewardsInfo

type NetworkRewardsInfo struct {
	CollateralRpl    *QuotedBigInt `json:"collateralRpl"`
	OracleDaoRpl     *QuotedBigInt `json:"oracleDaoRpl"`
	SmoothingPoolEth *QuotedBigInt `json:"smoothingPoolEth"`
}

Rewards per network

type NodeRewardsInfo

type NodeRewardsInfo struct {
	RewardNetwork                uint64        `json:"rewardNetwork"`
	CollateralRpl                *QuotedBigInt `json:"collateralRpl"`
	OracleDaoRpl                 *QuotedBigInt `json:"oracleDaoRpl"`
	SmoothingPoolEth             *QuotedBigInt `json:"smoothingPoolEth"`
	SmoothingPoolEligibilityRate float64       `json:"smoothingPoolEligibilityRate"`
	MerkleData                   []byte        `json:"-"`
	MerkleProof                  []string      `json:"merkleProof"`
}

Node operator rewards

func (*NodeRewardsInfo) GetMerkleProof

func (n *NodeRewardsInfo) GetMerkleProof() ([]common.Hash, error)

Get the deserialized Merkle Proof bytes

type NodeSmoothingDetails

type NodeSmoothingDetails struct {
	Address          common.Address
	IsEligible       bool
	IsOptedIn        bool
	StatusChangeTime time.Time
	Minipools        []*MinipoolInfo
	EligibleSeconds  *big.Int
	StartSlot        uint64
	EndSlot          uint64
	SmoothingPoolEth *big.Int
	RewardsNetwork   uint64

	// v2 Fields
	OptInTime  time.Time
	OptOutTime time.Time
}

Details about a node for the Smoothing Pool

type QuotedBigInt

type QuotedBigInt struct {
	big.Int
}

func NewQuotedBigInt

func NewQuotedBigInt(x int64) *QuotedBigInt

func (*QuotedBigInt) MarshalJSON

func (b *QuotedBigInt) MarshalJSON() ([]byte, error)

func (*QuotedBigInt) UnmarshalJSON

func (b *QuotedBigInt) UnmarshalJSON(p []byte) error

type RewardsFile

type RewardsFile struct {
	// Serialized fields
	RewardsFileVersion         uint64                              `json:"rewardsFileVersion"`
	RulesetVersion             uint64                              `json:"rulesetVersion,omitempty"`
	Index                      uint64                              `json:"index"`
	Network                    string                              `json:"network"`
	StartTime                  time.Time                           `json:"startTime,omitempty"`
	EndTime                    time.Time                           `json:"endTime"`
	ConsensusStartBlock        uint64                              `json:"consensusStartBlock,omitempty"`
	ConsensusEndBlock          uint64                              `json:"consensusEndBlock"`
	ExecutionStartBlock        uint64                              `json:"executionStartBlock,omitempty"`
	ExecutionEndBlock          uint64                              `json:"executionEndBlock"`
	IntervalsPassed            uint64                              `json:"intervalsPassed"`
	MerkleRoot                 string                              `json:"merkleRoot,omitempty"`
	MinipoolPerformanceFileCID string                              `json:"minipoolPerformanceFileCid,omitempty"`
	TotalRewards               *TotalRewards                       `json:"totalRewards"`
	NetworkRewards             map[uint64]*NetworkRewardsInfo      `json:"networkRewards"`
	NodeRewards                map[common.Address]*NodeRewardsInfo `json:"nodeRewards"`
	MinipoolPerformanceFile    MinipoolPerformanceFile             `json:"-"`

	// Non-serialized fields
	MerkleTree          *merkletree.MerkleTree    `json:"-"`
	InvalidNetworkNodes map[common.Address]uint64 `json:"-"`
}

JSON struct for a complete rewards file

type SlotInfo

type SlotInfo struct {
	Index      uint64
	Committees map[uint64]*CommitteeInfo
}

type SmoothingPoolMinipoolPerformance

type SmoothingPoolMinipoolPerformance struct {
	Pubkey                  string   `json:"pubkey"`
	StartSlot               uint64   `json:"startSlot,omitempty"`
	EndSlot                 uint64   `json:"endSlot,omitempty"`
	ActiveFraction          float64  `json:"activeFraction,omitempty"`
	SuccessfulAttestations  uint64   `json:"successfulAttestations"`
	MissedAttestations      uint64   `json:"missedAttestations"`
	ParticipationRate       float64  `json:"participationRate"`
	MissingAttestationSlots []uint64 `json:"missingAttestationSlots"`
	EthEarned               float64  `json:"ethEarned"`
}

Minipool stats

type TotalRewards

type TotalRewards struct {
	ProtocolDaoRpl               *QuotedBigInt `json:"protocolDaoRpl"`
	TotalCollateralRpl           *QuotedBigInt `json:"totalCollateralRpl"`
	TotalOracleDaoRpl            *QuotedBigInt `json:"totalOracleDaoRpl"`
	TotalSmoothingPoolEth        *QuotedBigInt `json:"totalSmoothingPoolEth"`
	PoolStakerSmoothingPoolEth   *QuotedBigInt `json:"poolStakerSmoothingPoolEth"`
	NodeOperatorSmoothingPoolEth *QuotedBigInt `json:"nodeOperatorSmoothingPoolEth"`
}

Total cumulative rewards for an interval

type TreeGenerator added in v1.7.1

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

func NewTreeGenerator added in v1.7.1

func NewTreeGenerator(logger log.ColorLogger, logPrefix string, rp *rocketpool.RocketPool, cfg *config.RocketPoolConfig, bc beacon.Client, index uint64, startTime time.Time, endTime time.Time, consensusBlock uint64, elSnapshotHeader *types.Header, intervalsPassed uint64, state *state.NetworkState) (*TreeGenerator, error)

func (*TreeGenerator) ApproximateStakerShareOfSmoothingPool added in v1.7.1

func (t *TreeGenerator) ApproximateStakerShareOfSmoothingPool() (*big.Int, error)

func (*TreeGenerator) ApproximateStakerShareOfSmoothingPoolWithRuleset added in v1.7.2

func (t *TreeGenerator) ApproximateStakerShareOfSmoothingPoolWithRuleset(ruleset uint64) (*big.Int, error)

func (*TreeGenerator) GenerateTree added in v1.7.1

func (t *TreeGenerator) GenerateTree() (*RewardsFile, error)

func (*TreeGenerator) GenerateTreeWithRuleset added in v1.7.2

func (t *TreeGenerator) GenerateTreeWithRuleset(ruleset uint64) (*RewardsFile, error)

func (*TreeGenerator) GetApproximatorRulesetVersion added in v1.7.2

func (t *TreeGenerator) GetApproximatorRulesetVersion() uint64

func (*TreeGenerator) GetGeneratorRulesetVersion added in v1.7.2

func (t *TreeGenerator) GetGeneratorRulesetVersion() uint64

Jump to

Keyboard shortcuts

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