rewards

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 56 Imported by: 3

Documentation

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
	MainnetV6Interval uint64 = 12
	MainnetV7Interval uint64 = 15
	MainnetV8Interval uint64 = 18

	// Devnet intervals
	DevnetV2Interval uint64 = 0
	DevnetV3Interval uint64 = 0
	DevnetV4Interval uint64 = 0
	DevnetV5Interval uint64 = 0
	DevnetV6Interval uint64 = 0
	DevnetV7Interval uint64 = 0

	// Holesky intervals
	HoleskyV2Interval uint64 = 0
	HoleskyV3Interval uint64 = 0
	HoleskyV4Interval uint64 = 0
	HoleskyV5Interval uint64 = 0
	HoleskyV6Interval uint64 = 0
	HoleskyV7Interval uint64 = 0
	HoleskyV8Interval uint64 = 93
)

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 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, opts *bind.CallOpts) (rewards.RewardsEvent, error)

Get the event for a rewards snapshot

func GetStartSlotForInterval added in v1.10.1

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

Gets the start slot for the given interval

Types

type CommitteeInfo

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

type ILocalFile added in v1.11.5

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

Interface for local rewards or minipool performance files

type IMinipoolPerformanceFile added in v1.11.0

type IMinipoolPerformanceFile interface {
	// Serialize a minipool performance file into bytes
	Serialize() ([]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 added in v1.11.0

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

Deserializes a byte array into a rewards file interface

type INodeRewardsInfo added in v1.11.0

type INodeRewardsInfo interface {
	GetRewardNetwork() uint64
	GetCollateralRpl() *QuotedBigInt
	GetOracleDaoRpl() *QuotedBigInt
	GetSmoothingPoolEth() *QuotedBigInt
	GetMerkleProof() ([]common.Hash, error)
}

Interface for version-agnostic node operator rewards

type IRewardsFile added in v1.11.0

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

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

	// Get the rewards file's header
	GetHeader() *RewardsFileHeader

	// 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

	// Get info about a node's rewards
	GetNodeRewardsInfo(address common.Address) (INodeRewardsInfo, bool)

	// Gets the minipool performance file corresponding to this rewards file
	GetMinipoolPerformanceFile() IMinipoolPerformanceFile

	// Sets the CID of the minipool performance file corresponding to this rewards file
	SetMinipoolPerformanceFileCID(cid string)
	// contains filtered or unexported methods
}

Interface for version-agnostic rewards files

func DeserializeRewardsFile added in v1.11.0

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

Deserializes a byte array into a rewards file interface

type ISmoothingPoolMinipoolPerformance added in v1.11.0

type ISmoothingPoolMinipoolPerformance interface {
	GetPubkey() (types.ValidatorPubkey, error)
	GetSuccessfulAttestationCount() uint64
	GetMissedAttestationCount() uint64
	GetMissingAttestationSlots() []uint64
	GetEthEarned() *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 *QuotedBigInt `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 added in v1.11.3

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

Downloads the rewards file for this interval

type LocalFile added in v1.11.5

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

A wrapper around ILocalFile 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 added in v1.11.5

func NewLocalFile[T ILocalFile](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 added in v1.11.5

func (lf *LocalFile[T]) CreateCompressedFileAndCid() (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]) Impl added in v1.11.5

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

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

func (*LocalFile[T]) Serialize added in v1.11.5

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

Converts the underlying interface to a byte slice

func (*LocalFile[T]) Write added in v1.11.5

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

Serializes the file and writes it to disk

type LocalMinipoolPerformanceFile added in v1.11.5

type LocalMinipoolPerformanceFile = LocalFile[IMinipoolPerformanceFile]

func ReadLocalMinipoolPerformanceFile added in v1.11.5

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

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

type LocalRewardsFile added in v1.11.5

type LocalRewardsFile = LocalFile[IRewardsFile]

Type aliases

func ReadLocalRewardsFile added in v1.11.5

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"`
}

type MinipoolPerformanceFile_v1 added in v1.11.0

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"`
}

Holds information

func (*MinipoolPerformanceFile_v1) Deserialize added in v1.11.0

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

Deserialize a minipool performance file from bytes

func (*MinipoolPerformanceFile_v1) GetMinipoolAddresses added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

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

Serialize a minipool performance file into bytes

func (*MinipoolPerformanceFile_v1) SerializeHuman added in v1.11.0

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

Serialize a minipool performance file into bytes designed for human readability

type MinipoolPerformanceFile_v2 added in v1.11.0

type MinipoolPerformanceFile_v2 struct {
	RewardsFileVersion  rewardsFileVersion                                      `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"`
}

Holds information

func (*MinipoolPerformanceFile_v2) Deserialize added in v1.11.0

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

Deserialize a minipool performance file from bytes

func (*MinipoolPerformanceFile_v2) GetMinipoolAddresses added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

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

Serialize a minipool performance file into bytes

func (*MinipoolPerformanceFile_v2) SerializeHuman added in v1.11.0

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

Serialize a minipool performance file into bytes designed for human readability

type MinipoolPerformanceFile_v3 added in v1.11.3

type MinipoolPerformanceFile_v3 struct {
	RewardsFileVersion  rewardsFileVersion                                      `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_v3 `json:"minipoolPerformance"`
}

Holds information

func (*MinipoolPerformanceFile_v3) Deserialize added in v1.11.3

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

Deserialize a minipool performance file from bytes

func (*MinipoolPerformanceFile_v3) GetMinipoolAddresses added in v1.11.3

func (f *MinipoolPerformanceFile_v3) 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_v3) GetSmoothingPoolPerformance added in v1.11.3

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

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

func (*MinipoolPerformanceFile_v3) Serialize added in v1.11.3

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

Serialize a minipool performance file into bytes

func (*MinipoolPerformanceFile_v3) SerializeHuman added in v1.11.3

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

Serialize a minipool performance file into bytes designed for human readability

type NetworkRewardsInfo

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

Rewards per network

type NodeRewardsInfo_v1 added in v1.11.0

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

func (*NodeRewardsInfo_v1) GetCollateralRpl added in v1.11.0

func (i *NodeRewardsInfo_v1) GetCollateralRpl() *QuotedBigInt

func (*NodeRewardsInfo_v1) GetMerkleProof added in v1.11.0

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

func (*NodeRewardsInfo_v1) GetOracleDaoRpl added in v1.11.0

func (i *NodeRewardsInfo_v1) GetOracleDaoRpl() *QuotedBigInt

func (*NodeRewardsInfo_v1) GetRewardNetwork added in v1.11.0

func (i *NodeRewardsInfo_v1) GetRewardNetwork() uint64

func (*NodeRewardsInfo_v1) GetSmoothingPoolEth added in v1.11.0

func (i *NodeRewardsInfo_v1) GetSmoothingPoolEth() *QuotedBigInt

type NodeRewardsInfo_v2 added in v1.11.0

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

func (*NodeRewardsInfo_v2) GetCollateralRpl added in v1.11.0

func (i *NodeRewardsInfo_v2) GetCollateralRpl() *QuotedBigInt

func (*NodeRewardsInfo_v2) GetMerkleProof added in v1.11.0

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

func (*NodeRewardsInfo_v2) GetOracleDaoRpl added in v1.11.0

func (i *NodeRewardsInfo_v2) GetOracleDaoRpl() *QuotedBigInt

func (*NodeRewardsInfo_v2) GetRewardNetwork added in v1.11.0

func (i *NodeRewardsInfo_v2) GetRewardNetwork() uint64

func (*NodeRewardsInfo_v2) GetSmoothingPoolEth added in v1.11.0

func (i *NodeRewardsInfo_v2) GetSmoothingPoolEth() *QuotedBigInt

type NodeRewardsInfo_v3 added in v1.11.3

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

func (*NodeRewardsInfo_v3) GetCollateralRpl added in v1.11.3

func (i *NodeRewardsInfo_v3) GetCollateralRpl() *QuotedBigInt

func (*NodeRewardsInfo_v3) GetMerkleProof added in v1.11.3

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

func (*NodeRewardsInfo_v3) GetOracleDaoRpl added in v1.11.3

func (i *NodeRewardsInfo_v3) GetOracleDaoRpl() *QuotedBigInt

func (*NodeRewardsInfo_v3) GetRewardNetwork added in v1.11.3

func (i *NodeRewardsInfo_v3) GetRewardNetwork() uint64

func (*NodeRewardsInfo_v3) GetSmoothingPoolEth added in v1.11.3

func (i *NodeRewardsInfo_v3) GetSmoothingPoolEth() *QuotedBigInt

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 RecordFileInfo added in v1.10.0

type RecordFileInfo struct {
	StartSlot uint64   `json:"startSlot"`
	EndSlot   uint64   `json:"endSlot"`
	Filename  string   `json:"filename"`
	Version   int      `json:"version"`
	Checksum  [48]byte `json:"checksum"`
}

Information about a saved rolling record

type RewardsFileHeader added in v1.11.0

type RewardsFileHeader struct {
	// Serialized fields
	RewardsFileVersion         rewardsFileVersion             `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:"-"`
	InvalidNetworkNodes map[common.Address]uint64 `json:"-"`
}

General version-agnostic information about a rewards file

type RewardsFile_v1 added in v1.11.0

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 added in v1.11.0

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

Deserialize a rewards file from bytes

func (*RewardsFile_v1) GetHeader added in v1.11.0

func (f *RewardsFile_v1) GetHeader() *RewardsFileHeader

Get the rewards file's header

func (*RewardsFile_v1) GetMinipoolPerformanceFile added in v1.11.0

func (f *RewardsFile_v1) GetMinipoolPerformanceFile() IMinipoolPerformanceFile

Gets the minipool performance file corresponding to this rewards file

func (*RewardsFile_v1) GetNodeAddresses added in v1.11.0

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) GetNodeRewardsInfo added in v1.11.0

func (f *RewardsFile_v1) GetNodeRewardsInfo(address common.Address) (INodeRewardsInfo, bool)

Get info about a node's rewards

func (*RewardsFile_v1) Serialize added in v1.11.0

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

Serialize a rewards file into bytes

func (*RewardsFile_v1) SetMinipoolPerformanceFileCID added in v1.11.0

func (f *RewardsFile_v1) SetMinipoolPerformanceFileCID(cid string)

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

type RewardsFile_v2 added in v1.11.0

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 added in v1.11.0

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

Deserialize a rewards file from bytes

func (*RewardsFile_v2) GetHeader added in v1.11.0

func (f *RewardsFile_v2) GetHeader() *RewardsFileHeader

Get the rewards file's header

func (*RewardsFile_v2) GetMinipoolPerformanceFile added in v1.11.0

func (f *RewardsFile_v2) GetMinipoolPerformanceFile() IMinipoolPerformanceFile

Gets the minipool performance file corresponding to this rewards file

func (*RewardsFile_v2) GetNodeAddresses added in v1.11.0

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) GetNodeRewardsInfo added in v1.11.0

func (f *RewardsFile_v2) GetNodeRewardsInfo(address common.Address) (INodeRewardsInfo, bool)

Get info about a node's rewards

func (*RewardsFile_v2) Serialize added in v1.11.0

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

Serialize a rewards file into bytes

func (*RewardsFile_v2) SetMinipoolPerformanceFileCID added in v1.11.0

func (f *RewardsFile_v2) SetMinipoolPerformanceFileCID(cid string)

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

type RewardsFile_v3 added in v1.11.3

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

JSON struct for a complete rewards file

func (*RewardsFile_v3) Deserialize added in v1.11.3

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

Deserialize a rewards file from bytes

func (*RewardsFile_v3) GetHeader added in v1.11.3

func (f *RewardsFile_v3) GetHeader() *RewardsFileHeader

Get the rewards file's header

func (*RewardsFile_v3) GetMinipoolPerformanceFile added in v1.11.3

func (f *RewardsFile_v3) GetMinipoolPerformanceFile() IMinipoolPerformanceFile

Gets the minipool performance file corresponding to this rewards file

func (*RewardsFile_v3) GetNodeAddresses added in v1.11.3

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) GetNodeRewardsInfo added in v1.11.3

func (f *RewardsFile_v3) GetNodeRewardsInfo(address common.Address) (INodeRewardsInfo, bool)

Get info about a node's rewards

func (*RewardsFile_v3) Serialize added in v1.11.3

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

Serialize a rewards file into bytes

func (*RewardsFile_v3) SetMinipoolPerformanceFileCID added in v1.11.3

func (f *RewardsFile_v3) SetMinipoolPerformanceFileCID(cid string)

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

type RollingRecord added in v1.10.0

type RollingRecord struct {
	StartSlot         uint64                   `json:"startSlot"`
	LastDutiesSlot    uint64                   `json:"lastDutiesSlot"`
	ValidatorIndexMap map[string]*MinipoolInfo `json:"validatorIndexMap"`
	RewardsInterval   uint64                   `json:"rewardsInterval"`
	SmartnodeVersion  string                   `json:"smartnodeVersion,omitempty"`
	// contains filtered or unexported fields
}

func DeserializeRollingRecord added in v1.10.0

func DeserializeRollingRecord(log *log.ColorLogger, logPrefix string, bc beacon.Client, beaconConfig *beacon.Eth2Config, bytes []byte) (*RollingRecord, error)

Load an existing record from serialized JSON data

func NewRollingRecord added in v1.10.0

func NewRollingRecord(log *log.ColorLogger, logPrefix string, bc beacon.Client, startSlot uint64, beaconConfig *beacon.Eth2Config, rewardsInterval uint64) *RollingRecord

Create a new rolling record wrapper

func (*RollingRecord) GetScores added in v1.10.0

func (r *RollingRecord) GetScores(cheatingNodes map[common.Address]bool) ([]*MinipoolInfo, *big.Int, uint64)

Get the minipool scores, along with the cumulative total score and count - ignores minipools that belonged to cheaters

func (*RollingRecord) Serialize added in v1.10.0

func (r *RollingRecord) Serialize() ([]byte, error)

Serialize the current record into a byte array

func (*RollingRecord) UpdateToSlot added in v1.10.0

func (r *RollingRecord) UpdateToSlot(slot uint64, state *state.NetworkState) error

Update the record to the requested slot, using the provided state as a reference. Requires the epoch *after* the requested slot to be finalized so it can accurately count attestations.

type RollingRecordManager added in v1.10.0

type RollingRecordManager struct {
	Record                       *RollingRecord
	LatestFinalizedEpoch         uint64
	ExpectedBalancesBlock        uint64
	ExpectedRewardsIntervalBlock uint64
	// contains filtered or unexported fields
}

Manager for RollingRecords

func NewRollingRecordManager added in v1.10.0

func NewRollingRecordManager(log *log.ColorLogger, errLog *log.ColorLogger, cfg *config.RocketPoolConfig, rp *rocketpool.RocketPool, bc beacon.Client, mgr *state.NetworkStateManager, startSlot uint64, beaconCfg beacon.Eth2Config, rewardsInterval uint64) (*RollingRecordManager, error)

Creates a new manager for rolling records.

func (*RollingRecordManager) GenerateRecordForState added in v1.10.0

func (r *RollingRecordManager) GenerateRecordForState(state *state.NetworkState) (*RollingRecord, error)

Generate a new record for the provided slot using the latest viable saved record

func (*RollingRecordManager) LoadBestRecordFromDisk added in v1.10.0

func (r *RollingRecordManager) LoadBestRecordFromDisk(startSlot uint64, targetSlot uint64, rewardsInterval uint64) (*RollingRecord, error)

Load the most recent appropriate rolling record from disk, using the checksum table as an index

func (*RollingRecordManager) PrepareRecordForReport added in v1.10.0

func (r *RollingRecordManager) PrepareRecordForReport(state *state.NetworkState) error

Prepares the record for a rewards interval report

func (*RollingRecordManager) SaveRecordToFile added in v1.10.0

func (r *RollingRecordManager) SaveRecordToFile(record *RollingRecord) error

Save the rolling record to a file and update the record info catalog

func (*RollingRecordManager) UpdateRecordToState added in v1.10.0

func (r *RollingRecordManager) UpdateRecordToState(state *state.NetworkState, latestFinalizedSlot uint64) error

Updates the manager's record to the provided state, retrying upon errors until success

type SlotInfo

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

type SmoothingPoolMinipoolPerformance_v1 added in v1.11.0

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) GetEthEarned added in v1.11.0

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

func (*SmoothingPoolMinipoolPerformance_v1) GetMissedAttestationCount added in v1.11.0

func (p *SmoothingPoolMinipoolPerformance_v1) GetMissedAttestationCount() uint64

func (*SmoothingPoolMinipoolPerformance_v1) GetMissingAttestationSlots added in v1.11.0

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

func (*SmoothingPoolMinipoolPerformance_v1) GetPubkey added in v1.11.0

func (*SmoothingPoolMinipoolPerformance_v1) GetSuccessfulAttestationCount added in v1.11.0

func (p *SmoothingPoolMinipoolPerformance_v1) GetSuccessfulAttestationCount() uint64

type SmoothingPoolMinipoolPerformance_v2 added in v1.11.0

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"`
}

Minipool stats

func (*SmoothingPoolMinipoolPerformance_v2) GetEthEarned added in v1.11.0

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

func (*SmoothingPoolMinipoolPerformance_v2) GetMissedAttestationCount added in v1.11.0

func (p *SmoothingPoolMinipoolPerformance_v2) GetMissedAttestationCount() uint64

func (*SmoothingPoolMinipoolPerformance_v2) GetMissingAttestationSlots added in v1.11.0

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

func (*SmoothingPoolMinipoolPerformance_v2) GetPubkey added in v1.11.0

func (*SmoothingPoolMinipoolPerformance_v2) GetSuccessfulAttestationCount added in v1.11.0

func (p *SmoothingPoolMinipoolPerformance_v2) GetSuccessfulAttestationCount() uint64

type SmoothingPoolMinipoolPerformance_v3 added in v1.11.3

type SmoothingPoolMinipoolPerformance_v3 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"`
}

Minipool stats

func (*SmoothingPoolMinipoolPerformance_v3) GetEthEarned added in v1.11.3

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

func (*SmoothingPoolMinipoolPerformance_v3) GetMissedAttestationCount added in v1.11.3

func (p *SmoothingPoolMinipoolPerformance_v3) GetMissedAttestationCount() uint64

func (*SmoothingPoolMinipoolPerformance_v3) GetMissingAttestationSlots added in v1.11.3

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

func (*SmoothingPoolMinipoolPerformance_v3) GetPubkey added in v1.11.3

func (*SmoothingPoolMinipoolPerformance_v3) GetSuccessfulAttestationCount added in v1.11.3

func (p *SmoothingPoolMinipoolPerformance_v3) GetSuccessfulAttestationCount() 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 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, rollingRecord *RollingRecord) (*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() (IRewardsFile, error)

func (*TreeGenerator) GenerateTreeWithRuleset added in v1.7.2

func (t *TreeGenerator) GenerateTreeWithRuleset(ruleset uint64) (IRewardsFile, 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

type VersionHeader added in v1.11.0

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

Small struct to test version information for rewards files during deserialization

Jump to

Keyboard shortcuts

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