rewards

package
v0.0.0-...-4478efc Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: GPL-3.0 Imports: 49 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SmoothingPoolDetailsBatchSize uint64 = 8

	// Mainnet intervals
	MainnetV8Interval  uint64 = 18
	MainnetV9Interval  uint64 = 29
	MainnetV10Interval uint64 = 30

	// Testnet intervals
	TestnetV10Interval uint64 = 0
)

Settings

View Source
const (
	FarEpoch uint64 = 18446744073709551615
)

Variables

This section is empty.

Functions

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 GetMainnetRulesetVersion

func GetMainnetRulesetVersion(interval uint64) uint64

func GetRulesetVersion

func GetRulesetVersion(network cfgtypes.Network, interval uint64) uint64

func GetStartSlotForInterval

func GetStartSlotForInterval(previousIntervalEvent rewards.RewardsEvent, bc RewardsBeaconClient, beaconConfig beacon.Eth2Config) (uint64, error)

Gets the start slot for the given interval

func NewRewardsExecutionClient

func NewRewardsExecutionClient(rp *rocketpool.RocketPool) *defaultRewardsExecutionClient

Types

type CommitteeInfo

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

type GenerateTreeResult

type GenerateTreeResult struct {
	RewardsFile             IRewardsFile
	MinipoolPerformanceFile IMinipoolPerformanceFile
	InvalidNetworkNodes     map[common.Address]uint64
}

type ILocalFile

type ILocalFile interface {
	ISerializable
	Write() ([]byte, error)
	WriteSSZ() ([]byte, error)
	Path() string
	FileName() string
	CreateCompressedFileAndCid() (string, cid.Cid, error)
}

type IMinipoolPerformanceFile

type IMinipoolPerformanceFile interface {
	// Serialize a minipool performance file into bytes
	Serialize() ([]byte, error)
	SerializeSSZ() ([]byte, error)

	// Serialize a minipool performance file into bytes designed for human readability
	SerializeHuman() ([]byte, error)

	// Deserialize a rewards file from bytes
	Deserialize([]byte) error

	// Get all of the minipool addresses with rewards in this file
	// NOTE: the order of minipool addresses is not guaranteed to be stable, so don't rely on it
	GetMinipoolAddresses() []common.Address

	// Get a minipool's smoothing pool performance if it was present
	GetSmoothingPoolPerformance(minipoolAddress common.Address) (ISmoothingPoolMinipoolPerformance, bool)
}

Interface for version-agnostic minipool performance

func DeserializeMinipoolPerformanceFile

func DeserializeMinipoolPerformanceFile(bytes []byte) (IMinipoolPerformanceFile, error)

Deserializes a byte array into a rewards file interface

type IRewardsFile

type IRewardsFile interface {
	// Serialize a rewards file into bytes
	Serialize() ([]byte, error)
	SerializeSSZ() ([]byte, error)

	// Deserialize a rewards file from bytes
	Deserialize([]byte) error

	// Getters for general interval info
	GetRewardsFileVersion() uint64
	GetIndex() uint64
	GetTotalNodeWeight() *big.Int
	GetMerkleRoot() string
	GetIntervalsPassed() uint64
	GetTotalProtocolDaoRpl() *big.Int
	GetTotalOracleDaoRpl() *big.Int
	GetTotalCollateralRpl() *big.Int
	GetTotalNodeOperatorSmoothingPoolEth() *big.Int
	GetTotalPoolStakerSmoothingPoolEth() *big.Int
	GetExecutionStartBlock() uint64
	GetConsensusStartBlock() uint64
	GetExecutionEndBlock() uint64
	GetConsensusEndBlock() uint64
	GetStartTime() time.Time
	GetEndTime() time.Time

	// Get all of the node addresses with rewards in this file
	// NOTE: the order of node addresses is not guaranteed to be stable, so don't rely on it
	GetNodeAddresses() []common.Address

	// Getters for into about specific node's rewards
	HasRewardsFor(common.Address) bool
	GetNodeCollateralRpl(common.Address) *big.Int
	GetNodeOracleDaoRpl(common.Address) *big.Int
	GetNodeSmoothingPoolEth(common.Address) *big.Int
	GetMerkleProof(common.Address) ([]common.Hash, error)

	// Getters for network info
	HasRewardsForNetwork(network uint64) bool
	GetNetworkCollateralRpl(network uint64) *big.Int
	GetNetworkOracleDaoRpl(network uint64) *big.Int
	GetNetworkSmoothingPoolEth(network uint64) *big.Int

	// Sets the CID of the minipool performance file corresponding to this rewards file
	SetMinipoolPerformanceFileCID(cid string)

	// Generate the Merkle Tree and its root from the rewards file's proofs
	GenerateMerkleTree() error
}

Interface for version-agnostic rewards files

func DeserializeRewardsFile

func DeserializeRewardsFile(bytes []byte) (IRewardsFile, error)

Deserializes a byte array into a rewards file interface

type ISerializable

type ISerializable interface {
	// Converts the underlying interface to a byte slice
	Serialize() ([]byte, error)
	SerializeSSZ() ([]byte, error)
}

Interface for local rewards or minipool performance files

type ISmoothingPoolMinipoolPerformance

type ISmoothingPoolMinipoolPerformance interface {
	GetPubkey() (types.ValidatorPubkey, error)
	GetSuccessfulAttestationCount() uint64
	GetMissedAttestationCount() uint64
	GetMissingAttestationSlots() []uint64
	GetEthEarned() *big.Int
	GetBonusEthEarned() *big.Int
	GetEffectiveCommission() *big.Int
	GetConsensusIncome() *big.Int
	GetAttestationScore() *big.Int
}

Minipool stats

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"`
	MerkleRoot             common.Hash   `json:"merkleRoot"`
	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"`

	TotalNodeWeight *big.Int `json:"-"`
}

Information about an interval

func GetIntervalInfo

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

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

func (*IntervalInfo) DownloadRewardsFile

func (i *IntervalInfo) DownloadRewardsFile(cfg *config.RocketPoolConfig, isDaemon bool) error

Downloads the rewards file for this interval

type LocalFile

type LocalFile[T ISerializable] struct {
	// contains filtered or unexported fields
}

A wrapper around ISerializable representing a local rewards file or minipool performance file. Can be used with anything that can be serialzed to bytes or parsed from bytes.

func NewLocalFile

func NewLocalFile[T ISerializable](ilf T, fullpath string) *LocalFile[T]

NewLocalFile creates the wrapper, but doesn't write to disk. This should be used when generating new trees / performance files.

func (*LocalFile[T]) CreateCompressedFileAndCid

func (lf *LocalFile[T]) CreateCompressedFileAndCid() (string, cid.Cid, error)

Computes the CID that would be used if we compressed the file with zst, added the ipfs extension to the filename (.zst), and uploaded it to ipfs in an empty directory, as web3storage did, once upon a time.

N.B. This function will also save the compressed file to disk so it can later be uploaded to ipfs

func (*LocalFile[T]) FileName

func (lf *LocalFile[T]) FileName() string

func (*LocalFile[T]) Impl

func (lf *LocalFile[T]) Impl() T

Returns the underlying interface, IRewardsFile for rewards file, IMinipoolPerformanceFile for performance, etc.

func (*LocalFile[T]) Path

func (lf *LocalFile[T]) Path() string

func (*LocalFile[T]) Serialize

func (lf *LocalFile[T]) Serialize() ([]byte, error)

Converts the underlying interface to a byte slice

func (*LocalFile[T]) SerializeSSZ

func (lf *LocalFile[T]) SerializeSSZ() ([]byte, error)

Converts the underlying interface to a byte slice by calling its SerializeSSZ function

func (*LocalFile[T]) Write

func (lf *LocalFile[T]) Write() ([]byte, error)

Serializes the file and writes it to disk

func (*LocalFile[T]) WriteSSZ

func (lf *LocalFile[T]) WriteSSZ() ([]byte, error)

Serializes the file and writes it to disk

type LocalMinipoolPerformanceFile

type LocalMinipoolPerformanceFile = LocalFile[IMinipoolPerformanceFile]

func ReadLocalMinipoolPerformanceFile

func ReadLocalMinipoolPerformanceFile(path string) (*LocalMinipoolPerformanceFile, error)

Reads an existing MinipoolPerformanceFile from disk and wraps it in a LocalFile

type LocalRewardsFile

type LocalRewardsFile = LocalFile[IRewardsFile]

Type aliases

func ReadLocalRewardsFile

func ReadLocalRewardsFile(path string) (*LocalRewardsFile, error)

Reads an existing RewardsFile from disk and wraps it in a LocalFile

type MinipoolInfo

type MinipoolInfo struct {
	Address                 common.Address        `json:"address"`
	ValidatorPubkey         types.ValidatorPubkey `json:"pubkey"`
	ValidatorIndex          string                `json:"index"`
	NodeAddress             common.Address        `json:"nodeAddress"`
	NodeIndex               uint64                `json:"-"`
	Fee                     *big.Int              `json:"-"`
	MissedAttestations      uint64                `json:"-"`
	GoodAttestations        uint64                `json:"-"`
	MinipoolShare           *big.Int              `json:"-"`
	MissingAttestationSlots map[uint64]bool       `json:"missingAttestationSlots"`
	WasActive               bool                  `json:"-"`
	StartSlot               uint64                `json:"-"`
	EndSlot                 uint64                `json:"-"`
	AttestationScore        *QuotedBigInt         `json:"attestationScore"`
	CompletedAttestations   map[uint64]bool       `json:"-"`
	AttestationCount        int                   `json:"attestationCount"`
	TotalFee                *big.Int              `json:"-"`
	MinipoolBonus           *big.Int              `json:"-"`
	NodeOperatorBond        *big.Int              `json:"-"`
	ConsensusIncome         *QuotedBigInt         `json:"consensusIncome"`
}

type MinipoolPerformanceFile_v1

type MinipoolPerformanceFile_v1 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_v1 `json:"minipoolPerformance"`
}

func (*MinipoolPerformanceFile_v1) Deserialize

func (f *MinipoolPerformanceFile_v1) Deserialize(bytes []byte) error

Deserialize a minipool performance file from bytes

func (*MinipoolPerformanceFile_v1) GetMinipoolAddresses

func (f *MinipoolPerformanceFile_v1) GetMinipoolAddresses() []common.Address

Get all of the minipool addresses with rewards in this file NOTE: the order of minipool addresses is not guaranteed to be stable, so don't rely on it

func (*MinipoolPerformanceFile_v1) GetSmoothingPoolPerformance

func (f *MinipoolPerformanceFile_v1) GetSmoothingPoolPerformance(minipoolAddress common.Address) (ISmoothingPoolMinipoolPerformance, bool)

Get a minipool's smoothing pool performance if it was present

func (*MinipoolPerformanceFile_v1) Serialize

func (f *MinipoolPerformanceFile_v1) Serialize() ([]byte, error)

Serialize a minipool performance file into bytes

func (*MinipoolPerformanceFile_v1) SerializeHuman

func (f *MinipoolPerformanceFile_v1) SerializeHuman() ([]byte, error)

Serialize a minipool performance file into bytes designed for human readability

func (*MinipoolPerformanceFile_v1) SerializeSSZ

func (f *MinipoolPerformanceFile_v1) SerializeSSZ() ([]byte, error)

type MinipoolPerformanceFile_v2

type MinipoolPerformanceFile_v2 struct {
	RewardsFileVersion  uint64                                                  `json:"rewardsFileVersion"`
	RulesetVersion      uint64                                                  `json:"rulesetVersion"`
	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_v2 `json:"minipoolPerformance"`
	BonusScalar         *QuotedBigInt                                           `json:"bonusScalar,omitempty"`
}

func (*MinipoolPerformanceFile_v2) Deserialize

func (f *MinipoolPerformanceFile_v2) Deserialize(bytes []byte) error

Deserialize a minipool performance file from bytes

func (*MinipoolPerformanceFile_v2) GetMinipoolAddresses

func (f *MinipoolPerformanceFile_v2) GetMinipoolAddresses() []common.Address

Get all of the minipool addresses with rewards in this file NOTE: the order of minipool addresses is not guaranteed to be stable, so don't rely on it

func (*MinipoolPerformanceFile_v2) GetSmoothingPoolPerformance

func (f *MinipoolPerformanceFile_v2) GetSmoothingPoolPerformance(minipoolAddress common.Address) (ISmoothingPoolMinipoolPerformance, bool)

Get a minipool's smoothing pool performance if it was present

func (*MinipoolPerformanceFile_v2) Serialize

func (f *MinipoolPerformanceFile_v2) Serialize() ([]byte, error)

Serialize a minipool performance file into bytes

func (*MinipoolPerformanceFile_v2) SerializeHuman

func (f *MinipoolPerformanceFile_v2) SerializeHuman() ([]byte, error)

Serialize a minipool performance file into bytes designed for human readability

func (*MinipoolPerformanceFile_v2) SerializeSSZ

func (f *MinipoolPerformanceFile_v2) SerializeSSZ() ([]byte, error)

type NetworkRewardsInfo

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

Rewards per network

type NodeRewardsInfo_v1

type NodeRewardsInfo_v1 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

type NodeRewardsInfo_v2

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

Node operator rewards

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

	// v10 Fields
	BonusEth            *big.Int
	EligibleBorrowedEth *big.Int
	RplStake            *big.Int
}

Details about a node for the Smoothing Pool

type QuotedBigInt

type QuotedBigInt struct {
	big.Int
}

func NewQuotedBigInt

func NewQuotedBigInt(x int64) *QuotedBigInt

func QuotedBigIntFromBigInt

func QuotedBigIntFromBigInt(x *big.Int) *QuotedBigInt

func (*QuotedBigInt) MarshalJSON

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

func (*QuotedBigInt) UnmarshalJSON

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

type RewardsBeaconClient

type RewardsBeaconClient interface {
	GetBeaconBlock(slot string) (beacon.BeaconBlock, bool, error)
	GetCommitteesForEpoch(epoch *uint64) (beacon.Committees, error)
	GetAttestations(slot string) ([]beacon.AttestationInfo, bool, error)
	GetEth2Config() (beacon.Eth2Config, error)
	GetBeaconHead() (beacon.BeaconHead, error)
}

RewardsBeaconClient defines and interface that contains only the functions from beacon.Client required for rewards generation. This facade makes it easier to perform dependency injection in tests.

type RewardsExecutionClient

type RewardsExecutionClient interface {
	GetNetworkEnabled(networkId *big.Int, opts *bind.CallOpts) (bool, error)
	HeaderByNumber(context.Context, *big.Int) (*ethtypes.Header, error)
	GetRewardsEvent(index uint64, rocketRewardsPoolAddresses []common.Address, opts *bind.CallOpts) (bool, rewards.RewardsEvent, error)
	GetRewardSnapshotEvent(previousRewardsPoolAddresses []common.Address, interval uint64, opts *bind.CallOpts) (rewards.RewardsEvent, error)
	GetRewardIndex(opts *bind.CallOpts) (*big.Int, error)
}

RewardsExecutionClient defines and interface that contains only the functions from rocketpool.RocketPool required for rewards generation. This facade makes it easier to perform dependency injection in tests.

type RewardsFileHeader

type RewardsFileHeader 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"`

	// Non-serialized fields
	MerkleTree *merkletree.MerkleTree `json:"-"`
}

General version-agnostic information about a rewards file

type RewardsFile_v1

type RewardsFile_v1 struct {
	*RewardsFileHeader
	NodeRewards             map[common.Address]*NodeRewardsInfo_v1 `json:"nodeRewards"`
	MinipoolPerformanceFile MinipoolPerformanceFile_v1             `json:"-"`
}

JSON struct for a complete rewards file

func (*RewardsFile_v1) Deserialize

func (f *RewardsFile_v1) Deserialize(bytes []byte) error

Deserialize a rewards file from bytes

func (*RewardsFile_v1) GenerateMerkleTree

func (f *RewardsFile_v1) GenerateMerkleTree() error

Generates a merkle tree from the provided rewards map

func (*RewardsFile_v1) GetConsensusEndBlock

func (f *RewardsFile_v1) GetConsensusEndBlock() uint64

Get The consensus end block

func (*RewardsFile_v1) GetConsensusStartBlock

func (f *RewardsFile_v1) GetConsensusStartBlock() uint64

Get The consensus start block

func (*RewardsFile_v1) GetEndTime

func (f *RewardsFile_v1) GetEndTime() time.Time

Get the end time

func (*RewardsFile_v1) GetExecutionEndBlock

func (f *RewardsFile_v1) GetExecutionEndBlock() uint64

Get The execution end block

func (*RewardsFile_v1) GetExecutionStartBlock

func (f *RewardsFile_v1) GetExecutionStartBlock() uint64

Get The execution start block

func (*RewardsFile_v1) GetIndex

func (f *RewardsFile_v1) GetIndex() uint64

Get the rewards file index

func (*RewardsFile_v1) GetIntervalsPassed

func (f *RewardsFile_v1) GetIntervalsPassed() uint64

Get the number of intervals that have passed

func (*RewardsFile_v1) GetMerkleProof

func (f *RewardsFile_v1) GetMerkleProof(addr common.Address) ([]common.Hash, error)

func (*RewardsFile_v1) GetMerkleRoot

func (f *RewardsFile_v1) GetMerkleRoot() string

Get the merkle root

func (*RewardsFile_v1) GetNetworkCollateralRpl

func (f *RewardsFile_v1) GetNetworkCollateralRpl(network uint64) *big.Int

func (*RewardsFile_v1) GetNetworkOracleDaoRpl

func (f *RewardsFile_v1) GetNetworkOracleDaoRpl(network uint64) *big.Int

func (*RewardsFile_v1) GetNetworkRewards

func (f *RewardsFile_v1) GetNetworkRewards(network uint64) *NetworkRewardsInfo

Get network rewards for a specific network

func (*RewardsFile_v1) GetNetworkSmoothingPoolEth

func (f *RewardsFile_v1) GetNetworkSmoothingPoolEth(network uint64) *big.Int

func (*RewardsFile_v1) GetNodeAddresses

func (f *RewardsFile_v1) GetNodeAddresses() []common.Address

Get all of the node addresses with rewards in this file NOTE: the order of node addresses is not guaranteed to be stable, so don't rely on it

func (*RewardsFile_v1) GetNodeCollateralRpl

func (f *RewardsFile_v1) GetNodeCollateralRpl(addr common.Address) *big.Int

func (*RewardsFile_v1) GetNodeOracleDaoRpl

func (f *RewardsFile_v1) GetNodeOracleDaoRpl(addr common.Address) *big.Int

func (*RewardsFile_v1) GetNodeSmoothingPoolEth

func (f *RewardsFile_v1) GetNodeSmoothingPoolEth(addr common.Address) *big.Int

func (*RewardsFile_v1) GetRewardsFileVersion

func (f *RewardsFile_v1) GetRewardsFileVersion() uint64

Get the rewards file version

func (*RewardsFile_v1) GetStartTime

func (f *RewardsFile_v1) GetStartTime() time.Time

Get the start time

func (*RewardsFile_v1) GetTotalCollateralRpl

func (f *RewardsFile_v1) GetTotalCollateralRpl() *big.Int

Get the total rpl sent to stakers

func (*RewardsFile_v1) GetTotalNodeOperatorSmoothingPoolEth

func (f *RewardsFile_v1) GetTotalNodeOperatorSmoothingPoolEth() *big.Int

Get the total smoothing pool eth sent to node operators

func (*RewardsFile_v1) GetTotalNodeWeight

func (f *RewardsFile_v1) GetTotalNodeWeight() *big.Int

Get the TotalNodeWeight (only added in v3)

func (*RewardsFile_v1) GetTotalOracleDaoRpl

func (f *RewardsFile_v1) GetTotalOracleDaoRpl() *big.Int

Get the total RPL sent to the pDAO

func (*RewardsFile_v1) GetTotalPoolStakerSmoothingPoolEth

func (f *RewardsFile_v1) GetTotalPoolStakerSmoothingPoolEth() *big.Int

Get the total Eth sent to pool stakers from the SP

func (*RewardsFile_v1) GetTotalProtocolDaoRpl

func (f *RewardsFile_v1) GetTotalProtocolDaoRpl() *big.Int

Get the total RPL sent to the pDAO

func (*RewardsFile_v1) HasRewardsFor

func (f *RewardsFile_v1) HasRewardsFor(addr common.Address) bool

func (*RewardsFile_v1) HasRewardsForNetwork

func (f *RewardsFile_v1) HasRewardsForNetwork(network uint64) bool

Getters for network info

func (*RewardsFile_v1) Serialize

func (f *RewardsFile_v1) Serialize() ([]byte, error)

Serialize a rewards file into bytes

func (*RewardsFile_v1) SerializeSSZ

func (f *RewardsFile_v1) SerializeSSZ() ([]byte, error)

func (*RewardsFile_v1) SetMinipoolPerformanceFileCID

func (f *RewardsFile_v1) SetMinipoolPerformanceFileCID(cid string)

Sets the CID of the minipool performance file corresponding to this rewards file

type RewardsFile_v2

type RewardsFile_v2 struct {
	*RewardsFileHeader
	NodeRewards             map[common.Address]*NodeRewardsInfo_v2 `json:"nodeRewards"`
	MinipoolPerformanceFile MinipoolPerformanceFile_v2             `json:"-"`
}

JSON struct for a complete rewards file

func (*RewardsFile_v2) Deserialize

func (f *RewardsFile_v2) Deserialize(bytes []byte) error

Deserialize a rewards file from bytes

func (*RewardsFile_v2) GenerateMerkleTree

func (f *RewardsFile_v2) GenerateMerkleTree() error

Generates a merkle tree from the provided rewards map

func (*RewardsFile_v2) GetConsensusEndBlock

func (f *RewardsFile_v2) GetConsensusEndBlock() uint64

Get The consensus end block

func (*RewardsFile_v2) GetConsensusStartBlock

func (f *RewardsFile_v2) GetConsensusStartBlock() uint64

Get The consensus start block

func (*RewardsFile_v2) GetEndTime

func (f *RewardsFile_v2) GetEndTime() time.Time

Get the end time

func (*RewardsFile_v2) GetExecutionEndBlock

func (f *RewardsFile_v2) GetExecutionEndBlock() uint64

Get The execution end block

func (*RewardsFile_v2) GetExecutionStartBlock

func (f *RewardsFile_v2) GetExecutionStartBlock() uint64

Get The execution start block

func (*RewardsFile_v2) GetIndex

func (f *RewardsFile_v2) GetIndex() uint64

Get the rewards file index

func (*RewardsFile_v2) GetIntervalsPassed

func (f *RewardsFile_v2) GetIntervalsPassed() uint64

Get the number of intervals that have passed

func (*RewardsFile_v2) GetMerkleProof

func (f *RewardsFile_v2) GetMerkleProof(addr common.Address) ([]common.Hash, error)

func (*RewardsFile_v2) GetMerkleRoot

func (f *RewardsFile_v2) GetMerkleRoot() string

Get the merkle root

func (*RewardsFile_v2) GetNetworkCollateralRpl

func (f *RewardsFile_v2) GetNetworkCollateralRpl(network uint64) *big.Int

func (*RewardsFile_v2) GetNetworkOracleDaoRpl

func (f *RewardsFile_v2) GetNetworkOracleDaoRpl(network uint64) *big.Int

func (*RewardsFile_v2) GetNetworkRewards

func (f *RewardsFile_v2) GetNetworkRewards(network uint64) *NetworkRewardsInfo

Get network rewards for a specific network

func (*RewardsFile_v2) GetNetworkSmoothingPoolEth

func (f *RewardsFile_v2) GetNetworkSmoothingPoolEth(network uint64) *big.Int

func (*RewardsFile_v2) GetNodeAddresses

func (f *RewardsFile_v2) GetNodeAddresses() []common.Address

Get all of the node addresses with rewards in this file NOTE: the order of node addresses is not guaranteed to be stable, so don't rely on it

func (*RewardsFile_v2) GetNodeCollateralRpl

func (f *RewardsFile_v2) GetNodeCollateralRpl(addr common.Address) *big.Int

func (*RewardsFile_v2) GetNodeOracleDaoRpl

func (f *RewardsFile_v2) GetNodeOracleDaoRpl(addr common.Address) *big.Int

func (*RewardsFile_v2) GetNodeSmoothingPoolEth

func (f *RewardsFile_v2) GetNodeSmoothingPoolEth(addr common.Address) *big.Int

func (*RewardsFile_v2) GetRewardsFileVersion

func (f *RewardsFile_v2) GetRewardsFileVersion() uint64

Get the rewards file version

func (*RewardsFile_v2) GetStartTime

func (f *RewardsFile_v2) GetStartTime() time.Time

Get the start time

func (*RewardsFile_v2) GetTotalCollateralRpl

func (f *RewardsFile_v2) GetTotalCollateralRpl() *big.Int

Get the total rpl sent to stakers

func (*RewardsFile_v2) GetTotalNodeOperatorSmoothingPoolEth

func (f *RewardsFile_v2) GetTotalNodeOperatorSmoothingPoolEth() *big.Int

Get the total smoothing pool eth sent to node operators

func (*RewardsFile_v2) GetTotalNodeWeight

func (f *RewardsFile_v2) GetTotalNodeWeight() *big.Int

Get the TotalNodeWeight (only added in v3)

func (*RewardsFile_v2) GetTotalOracleDaoRpl

func (f *RewardsFile_v2) GetTotalOracleDaoRpl() *big.Int

Get the total RPL sent to the pDAO

func (*RewardsFile_v2) GetTotalPoolStakerSmoothingPoolEth

func (f *RewardsFile_v2) GetTotalPoolStakerSmoothingPoolEth() *big.Int

Get the total Eth sent to pool stakers from the SP

func (*RewardsFile_v2) GetTotalProtocolDaoRpl

func (f *RewardsFile_v2) GetTotalProtocolDaoRpl() *big.Int

Get the total RPL sent to the pDAO

func (*RewardsFile_v2) HasRewardsFor

func (f *RewardsFile_v2) HasRewardsFor(addr common.Address) bool

func (*RewardsFile_v2) HasRewardsForNetwork

func (f *RewardsFile_v2) HasRewardsForNetwork(network uint64) bool

Getters for network info

func (*RewardsFile_v2) Serialize

func (f *RewardsFile_v2) Serialize() ([]byte, error)

Serialize a rewards file into bytes

func (*RewardsFile_v2) SerializeSSZ

func (f *RewardsFile_v2) SerializeSSZ() ([]byte, error)

func (*RewardsFile_v2) SetMinipoolPerformanceFileCID

func (f *RewardsFile_v2) SetMinipoolPerformanceFileCID(cid string)

Sets the CID of the minipool performance file corresponding to this rewards file

type RewardsFile_v3

type RewardsFile_v3 struct {
	*RewardsFileHeader
	NodeRewards             map[common.Address]*NodeRewardsInfo_v2 `json:"nodeRewards"`
	MinipoolPerformanceFile MinipoolPerformanceFile_v2             `json:"-"`
}

JSON struct for a complete rewards file

func (*RewardsFile_v3) Deserialize

func (f *RewardsFile_v3) Deserialize(bytes []byte) error

Deserialize a rewards file from bytes

func (*RewardsFile_v3) GenerateMerkleTree

func (f *RewardsFile_v3) GenerateMerkleTree() error

Generates a merkle tree from the provided rewards map

func (*RewardsFile_v3) GetConsensusEndBlock

func (f *RewardsFile_v3) GetConsensusEndBlock() uint64

Get the consensus end block

func (*RewardsFile_v3) GetConsensusStartBlock

func (f *RewardsFile_v3) GetConsensusStartBlock() uint64

Get the consensus start block

func (*RewardsFile_v3) GetEndTime

func (f *RewardsFile_v3) GetEndTime() time.Time

Get the end time

func (*RewardsFile_v3) GetExecutionEndBlock

func (f *RewardsFile_v3) GetExecutionEndBlock() uint64

Get the execution end block

func (*RewardsFile_v3) GetExecutionStartBlock

func (f *RewardsFile_v3) GetExecutionStartBlock() uint64

Get the execution start block

func (*RewardsFile_v3) GetIndex

func (f *RewardsFile_v3) GetIndex() uint64

Get the rewards file index

func (*RewardsFile_v3) GetIntervalsPassed

func (f *RewardsFile_v3) GetIntervalsPassed() uint64

Get the number of intervals that have passed

func (*RewardsFile_v3) GetMerkleProof

func (f *RewardsFile_v3) GetMerkleProof(addr common.Address) ([]common.Hash, error)

func (*RewardsFile_v3) GetMerkleRoot

func (f *RewardsFile_v3) GetMerkleRoot() string

Get the merkle root

func (*RewardsFile_v3) GetNetworkCollateralRpl

func (f *RewardsFile_v3) GetNetworkCollateralRpl(network uint64) *big.Int

func (*RewardsFile_v3) GetNetworkOracleDaoRpl

func (f *RewardsFile_v3) GetNetworkOracleDaoRpl(network uint64) *big.Int

func (*RewardsFile_v3) GetNetworkRewards

func (f *RewardsFile_v3) GetNetworkRewards(network uint64) *NetworkRewardsInfo

Get network rewards for a specific network

func (*RewardsFile_v3) GetNetworkSmoothingPoolEth

func (f *RewardsFile_v3) GetNetworkSmoothingPoolEth(network uint64) *big.Int

func (*RewardsFile_v3) GetNodeAddresses

func (f *RewardsFile_v3) GetNodeAddresses() []common.Address

Get all of the node addresses with rewards in this file NOTE: the order of node addresses is not guaranteed to be stable, so don't rely on it

func (*RewardsFile_v3) GetNodeCollateralRpl

func (f *RewardsFile_v3) GetNodeCollateralRpl(addr common.Address) *big.Int

func (*RewardsFile_v3) GetNodeOracleDaoRpl

func (f *RewardsFile_v3) GetNodeOracleDaoRpl(addr common.Address) *big.Int

func (*RewardsFile_v3) GetNodeSmoothingPoolEth

func (f *RewardsFile_v3) GetNodeSmoothingPoolEth(addr common.Address) *big.Int

func (*RewardsFile_v3) GetRewardsFileVersion

func (f *RewardsFile_v3) GetRewardsFileVersion() uint64

Get the rewards file version

func (*RewardsFile_v3) GetStartTime

func (f *RewardsFile_v3) GetStartTime() time.Time

Get the start time

func (*RewardsFile_v3) GetTotalCollateralRpl

func (f *RewardsFile_v3) GetTotalCollateralRpl() *big.Int

Get the total rpl sent to stakers

func (*RewardsFile_v3) GetTotalNodeOperatorSmoothingPoolEth

func (f *RewardsFile_v3) GetTotalNodeOperatorSmoothingPoolEth() *big.Int

Get the total smoothing pool eth sent to node operators

func (*RewardsFile_v3) GetTotalNodeWeight

func (f *RewardsFile_v3) GetTotalNodeWeight() *big.Int

Get the TotalNodeWeight (only added in v3)

func (*RewardsFile_v3) GetTotalOracleDaoRpl

func (f *RewardsFile_v3) GetTotalOracleDaoRpl() *big.Int

Get the total RPL sent to the pDAO

func (*RewardsFile_v3) GetTotalPoolStakerSmoothingPoolEth

func (f *RewardsFile_v3) GetTotalPoolStakerSmoothingPoolEth() *big.Int

Get the total Eth sent to pool stakers from the SP

func (*RewardsFile_v3) GetTotalProtocolDaoRpl

func (f *RewardsFile_v3) GetTotalProtocolDaoRpl() *big.Int

Get the total RPL sent to the pDAO

func (*RewardsFile_v3) HasRewardsFor

func (f *RewardsFile_v3) HasRewardsFor(addr common.Address) bool

func (*RewardsFile_v3) HasRewardsForNetwork

func (f *RewardsFile_v3) HasRewardsForNetwork(network uint64) bool

Getters for network info

func (*RewardsFile_v3) Serialize

func (f *RewardsFile_v3) Serialize() ([]byte, error)

Serialize a rewards file into bytes

func (*RewardsFile_v3) SerializeSSZ

func (f *RewardsFile_v3) SerializeSSZ() ([]byte, error)

Serialize as SSZ

func (*RewardsFile_v3) SetMinipoolPerformanceFileCID

func (f *RewardsFile_v3) SetMinipoolPerformanceFileCID(cid string)

Sets the CID of the minipool performance file corresponding to this rewards file

type SlotInfo

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

type SmoothingPoolMinipoolPerformance_v1

type SmoothingPoolMinipoolPerformance_v1 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

func (*SmoothingPoolMinipoolPerformance_v1) GetAttestationScore

func (p *SmoothingPoolMinipoolPerformance_v1) GetAttestationScore() *big.Int

func (*SmoothingPoolMinipoolPerformance_v1) GetBonusEthEarned

func (p *SmoothingPoolMinipoolPerformance_v1) GetBonusEthEarned() *big.Int

func (*SmoothingPoolMinipoolPerformance_v1) GetConsensusIncome

func (p *SmoothingPoolMinipoolPerformance_v1) GetConsensusIncome() *big.Int

func (*SmoothingPoolMinipoolPerformance_v1) GetEffectiveCommission

func (p *SmoothingPoolMinipoolPerformance_v1) GetEffectiveCommission() *big.Int

func (*SmoothingPoolMinipoolPerformance_v1) GetEthEarned

func (p *SmoothingPoolMinipoolPerformance_v1) GetEthEarned() *big.Int

func (*SmoothingPoolMinipoolPerformance_v1) GetMissedAttestationCount

func (p *SmoothingPoolMinipoolPerformance_v1) GetMissedAttestationCount() uint64

func (*SmoothingPoolMinipoolPerformance_v1) GetMissingAttestationSlots

func (p *SmoothingPoolMinipoolPerformance_v1) GetMissingAttestationSlots() []uint64

func (*SmoothingPoolMinipoolPerformance_v1) GetPubkey

func (*SmoothingPoolMinipoolPerformance_v1) GetSuccessfulAttestationCount

func (p *SmoothingPoolMinipoolPerformance_v1) GetSuccessfulAttestationCount() uint64

type SmoothingPoolMinipoolPerformance_v2

type SmoothingPoolMinipoolPerformance_v2 struct {
	Pubkey                  string        `json:"pubkey"`
	SuccessfulAttestations  uint64        `json:"successfulAttestations"`
	MissedAttestations      uint64        `json:"missedAttestations"`
	AttestationScore        *QuotedBigInt `json:"attestationScore"`
	MissingAttestationSlots []uint64      `json:"missingAttestationSlots"`
	EthEarned               *QuotedBigInt `json:"ethEarned"`
	ConsensusIncome         *QuotedBigInt `json:"consensusIncome,omitempty"`
	BonusEthEarned          *QuotedBigInt `json:"bonusEthEarned,omitempty"`
	EffectiveCommission     *QuotedBigInt `json:"effectiveCommission,omitempty"`
}

Minipool stats

func (*SmoothingPoolMinipoolPerformance_v2) GetAttestationScore

func (p *SmoothingPoolMinipoolPerformance_v2) GetAttestationScore() *big.Int

func (*SmoothingPoolMinipoolPerformance_v2) GetBonusEthEarned

func (p *SmoothingPoolMinipoolPerformance_v2) GetBonusEthEarned() *big.Int

func (*SmoothingPoolMinipoolPerformance_v2) GetConsensusIncome

func (p *SmoothingPoolMinipoolPerformance_v2) GetConsensusIncome() *big.Int

func (*SmoothingPoolMinipoolPerformance_v2) GetEffectiveCommission

func (p *SmoothingPoolMinipoolPerformance_v2) GetEffectiveCommission() *big.Int

func (*SmoothingPoolMinipoolPerformance_v2) GetEthEarned

func (p *SmoothingPoolMinipoolPerformance_v2) GetEthEarned() *big.Int

func (*SmoothingPoolMinipoolPerformance_v2) GetMissedAttestationCount

func (p *SmoothingPoolMinipoolPerformance_v2) GetMissedAttestationCount() uint64

func (*SmoothingPoolMinipoolPerformance_v2) GetMissingAttestationSlots

func (p *SmoothingPoolMinipoolPerformance_v2) GetMissingAttestationSlots() []uint64

func (*SmoothingPoolMinipoolPerformance_v2) GetPubkey

func (*SmoothingPoolMinipoolPerformance_v2) GetSuccessfulAttestationCount

func (p *SmoothingPoolMinipoolPerformance_v2) GetSuccessfulAttestationCount() uint64

type SnapshotEnd

type SnapshotEnd struct {
	// Slot is the last slot of the interval
	Slot uint64
	// ConsensusBlock is the last non-missed slot of the interval
	ConsensusBlock uint64
	// ExecutionBlock is the EL block number of ConsensusBlock
	ExecutionBlock uint64
}

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"`
	TotalNodeWeight              *QuotedBigInt `json:"totalNodeWeight,omitempty"`
}

Total cumulative rewards for an interval

type TreeGenerator

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

func NewTreeGenerator

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

func (*TreeGenerator) ApproximateStakerShareOfSmoothingPool

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

func (*TreeGenerator) ApproximateStakerShareOfSmoothingPoolWithRuleset

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

func (*TreeGenerator) GenerateTree

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

func (*TreeGenerator) GenerateTreeWithRuleset

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

func (*TreeGenerator) GetApproximatorRulesetVersion

func (t *TreeGenerator) GetApproximatorRulesetVersion() uint64

func (*TreeGenerator) GetGeneratorRulesetVersion

func (t *TreeGenerator) GetGeneratorRulesetVersion() uint64

func (*TreeGenerator) SaveFiles

func (t *TreeGenerator) SaveFiles(treeResult *GenerateTreeResult, nodeTrusted bool) (cid.Cid, map[string]cid.Cid, error)

type VersionHeader

type VersionHeader struct {
	RewardsFileVersion uint64 `json:"rewardsFileVersion,omitempty"`
}

Small struct to test version information for rewards files during deserialization

Directories

Path Synopsis
Code generated by fastssz.
Code generated by fastssz.
big

Jump to

Keyboard shortcuts

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