rewards

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: 54 Imported by: 6

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
	LegacyDetailsBatchCount int    = 200
)

Settings

Variables

This section is empty.

Functions

func DeserializeMinipoolPerformanceFile

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

Deserializes a byte array into a rewards file interface

func DeserializeRewardsFile

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

Deserializes a byte array into a rewards file interface

func DownloadRewardsFile

func DownloadRewardsFile(cfg *config.SmartNodeConfig, i *sharedtypes.IntervalInfo) error

Downloads the rewards file for this interval

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 GetIntervalInfo

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

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

func GetRewardSnapshotEvent

func GetRewardSnapshotEvent(rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, interval uint64, opts *bind.CallOpts) (rewards.RewardsEvent, error)

Get the event for a rewards snapshot

func GetStartSlotForInterval

func GetStartSlotForInterval(context context.Context, previousIntervalEvent rewards.RewardsEvent, bc beacon.IBeaconClient, beaconConfig beacon.Eth2Config) (uint64, error)

Gets the start slot for the given interval

Types

type ClaimStatus

type ClaimStatus struct {
	Claimed   []uint64
	Unclaimed []uint64
}

func GetClaimStatus

func GetClaimStatus(rp *rocketpool.RocketPool, nodeAddress common.Address, currentIndex uint64) (*ClaimStatus, error)

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

type CommitteeInfo

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

type ILocalFile

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

Interface for local rewards or minipool performance files

type IntervalDutiesInfo

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

type LocalFile

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

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

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

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

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

func (*LocalFile[T]) Serialize

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

Converts the underlying interface to a byte slice

func (*LocalFile[T]) Write

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

Serializes the file and writes it to disk

type LocalMinipoolPerformanceFile

type LocalMinipoolPerformanceFile = LocalFile[sharedtypes.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[sharedtypes.IRewardsFile]

Type aliases

func ReadLocalRewardsFile

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

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

type MinipoolDetails

type MinipoolDetails struct {
	Address      common.Address
	Exists       bool
	Status       types.MinipoolStatus
	Pubkey       beacon.ValidatorPubkey
	PenaltyCount uint64
	NodeFee      *big.Int
}

Legacy carryover from rocketpool-go v1 for interval 4 and 5 generators

type MinipoolInfo

type MinipoolInfo struct {
	Address                 common.Address            `json:"address"`
	ValidatorPubkey         beacon.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        *sharedtypes.QuotedBigInt `json:"attestationScore"`
	CompletedAttestations   map[uint64]bool           `json:"-"`
	AttestationCount        int                       `json:"attestationCount"`
}

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

Holds information

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) (sharedtypes.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

type MinipoolPerformanceFile_v2

type MinipoolPerformanceFile_v2 struct {
	RewardsFileVersion  sharedtypes.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

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) (sharedtypes.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

type MinipoolPerformanceFile_v3

type MinipoolPerformanceFile_v3 struct {
	RewardsFileVersion  sharedtypes.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

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

Deserialize a minipool performance file from bytes

func (*MinipoolPerformanceFile_v3) GetMinipoolAddresses

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

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

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

func (*MinipoolPerformanceFile_v3) Serialize

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

Serialize a minipool performance file into bytes

func (*MinipoolPerformanceFile_v3) SerializeHuman

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

Serialize a minipool performance file into bytes designed for human readability

type NodeRewardsInfo_v1

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

Node operator rewards

func (*NodeRewardsInfo_v1) GetCollateralRpl

func (i *NodeRewardsInfo_v1) GetCollateralRpl() *sharedtypes.QuotedBigInt

func (*NodeRewardsInfo_v1) GetMerkleProof

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

func (*NodeRewardsInfo_v1) GetOracleDaoRpl

func (i *NodeRewardsInfo_v1) GetOracleDaoRpl() *sharedtypes.QuotedBigInt

func (*NodeRewardsInfo_v1) GetRewardNetwork

func (i *NodeRewardsInfo_v1) GetRewardNetwork() uint64

func (*NodeRewardsInfo_v1) GetSmoothingPoolEth

func (i *NodeRewardsInfo_v1) GetSmoothingPoolEth() *sharedtypes.QuotedBigInt

type NodeRewardsInfo_v2

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

Node operator rewards

func (*NodeRewardsInfo_v2) GetCollateralRpl

func (i *NodeRewardsInfo_v2) GetCollateralRpl() *sharedtypes.QuotedBigInt

func (*NodeRewardsInfo_v2) GetMerkleProof

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

func (*NodeRewardsInfo_v2) GetOracleDaoRpl

func (i *NodeRewardsInfo_v2) GetOracleDaoRpl() *sharedtypes.QuotedBigInt

func (*NodeRewardsInfo_v2) GetRewardNetwork

func (i *NodeRewardsInfo_v2) GetRewardNetwork() uint64

func (*NodeRewardsInfo_v2) GetSmoothingPoolEth

func (i *NodeRewardsInfo_v2) GetSmoothingPoolEth() *sharedtypes.QuotedBigInt

type NodeRewardsInfo_v3

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

Node operator rewards

func (*NodeRewardsInfo_v3) GetCollateralRpl

func (i *NodeRewardsInfo_v3) GetCollateralRpl() *sharedtypes.QuotedBigInt

func (*NodeRewardsInfo_v3) GetMerkleProof

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

func (*NodeRewardsInfo_v3) GetOracleDaoRpl

func (i *NodeRewardsInfo_v3) GetOracleDaoRpl() *sharedtypes.QuotedBigInt

func (*NodeRewardsInfo_v3) GetRewardNetwork

func (i *NodeRewardsInfo_v3) GetRewardNetwork() uint64

func (*NodeRewardsInfo_v3) GetSmoothingPoolEth

func (i *NodeRewardsInfo_v3) GetSmoothingPoolEth() *sharedtypes.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 RecordFileInfo

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 RewardsFile_v1

type RewardsFile_v1 struct {
	*sharedtypes.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) GetHeader

Get the rewards file's header

func (*RewardsFile_v1) GetMinipoolPerformanceFile

func (f *RewardsFile_v1) GetMinipoolPerformanceFile() sharedtypes.IMinipoolPerformanceFile

Gets the minipool performance file corresponding to this rewards file

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) GetNodeRewardsInfo

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

Get info about a node's rewards

func (*RewardsFile_v1) Serialize

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

Serialize a rewards file into bytes

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 {
	*sharedtypes.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) GetHeader

Get the rewards file's header

func (*RewardsFile_v2) GetMinipoolPerformanceFile

func (f *RewardsFile_v2) GetMinipoolPerformanceFile() sharedtypes.IMinipoolPerformanceFile

Gets the minipool performance file corresponding to this rewards file

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) GetNodeRewardsInfo

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

Get info about a node's rewards

func (*RewardsFile_v2) Serialize

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

Serialize a rewards file into bytes

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 {
	*sharedtypes.RewardsFileHeader
	NodeRewards             map[common.Address]*NodeRewardsInfo_v3 `json:"nodeRewards"`
	MinipoolPerformanceFile MinipoolPerformanceFile_v3             `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) GetHeader

Get the rewards file's header

func (*RewardsFile_v3) GetMinipoolPerformanceFile

func (f *RewardsFile_v3) GetMinipoolPerformanceFile() sharedtypes.IMinipoolPerformanceFile

Gets the minipool performance file corresponding to this rewards file

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) GetNodeRewardsInfo

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

Get info about a node's rewards

func (*RewardsFile_v3) Serialize

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

Serialize a rewards file into bytes

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 RollingRecord

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

func DeserializeRollingRecord(logger *slog.Logger, bc beacon.IBeaconClient, beaconConfig *beacon.Eth2Config, bytes []byte) (*RollingRecord, error)

Load an existing record from serialized JSON data

func NewRollingRecord

func NewRollingRecord(logger *slog.Logger, bc beacon.IBeaconClient, startSlot uint64, beaconConfig *beacon.Eth2Config, rewardsInterval uint64) *RollingRecord

Create a new rolling record wrapper

func (*RollingRecord) GetScores

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

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

Serialize the current record into a byte array

func (*RollingRecord) UpdateToSlot

func (r *RollingRecord) UpdateToSlot(context context.Context, 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

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

Manager for RollingRecords

func NewRollingRecordManager

func NewRollingRecordManager(logger *slog.Logger, cfg *config.SmartNodeConfig, rp *rocketpool.RocketPool, bc beacon.IBeaconClient, mgr *state.NetworkStateManager, startSlot uint64, beaconCfg beacon.Eth2Config, rewardsInterval uint64) (*RollingRecordManager, error)

Creates a new manager for rolling records.

func (*RollingRecordManager) GenerateRecordForState

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

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

func (*RollingRecordManager) LoadBestRecordFromDisk

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

func (r *RollingRecordManager) PrepareRecordForReport(context context.Context, state *state.NetworkState) error

Prepares the record for a rewards interval report

func (*RollingRecordManager) SaveRecordToFile

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

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

func (*RollingRecordManager) UpdateRecordToState

func (r *RollingRecordManager) UpdateRecordToState(context context.Context, 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

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

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        *sharedtypes.QuotedBigInt `json:"attestationScore"`
	MissingAttestationSlots []uint64                  `json:"missingAttestationSlots"`
	EthEarned               *sharedtypes.QuotedBigInt `json:"ethEarned"`
}

Minipool stats

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 SmoothingPoolMinipoolPerformance_v3

type SmoothingPoolMinipoolPerformance_v3 struct {
	Pubkey                  string                    `json:"pubkey"`
	SuccessfulAttestations  uint64                    `json:"successfulAttestations"`
	MissedAttestations      uint64                    `json:"missedAttestations"`
	AttestationScore        *sharedtypes.QuotedBigInt `json:"attestationScore"`
	MissingAttestationSlots []uint64                  `json:"missingAttestationSlots"`
	EthEarned               *sharedtypes.QuotedBigInt `json:"ethEarned"`
}

Minipool stats

func (*SmoothingPoolMinipoolPerformance_v3) GetEthEarned

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

func (*SmoothingPoolMinipoolPerformance_v3) GetMissedAttestationCount

func (p *SmoothingPoolMinipoolPerformance_v3) GetMissedAttestationCount() uint64

func (*SmoothingPoolMinipoolPerformance_v3) GetMissingAttestationSlots

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

func (*SmoothingPoolMinipoolPerformance_v3) GetPubkey

func (*SmoothingPoolMinipoolPerformance_v3) GetSuccessfulAttestationCount

func (p *SmoothingPoolMinipoolPerformance_v3) GetSuccessfulAttestationCount() uint64

type TreeGenerator

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

func NewTreeGenerator

func NewTreeGenerator(logger *slog.Logger, rp *rocketpool.RocketPool, cfg *config.SmartNodeConfig, bc beacon.IBeaconClient, 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

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

func (*TreeGenerator) ApproximateStakerShareOfSmoothingPoolWithRuleset

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

func (*TreeGenerator) GenerateTree

func (t *TreeGenerator) GenerateTree(context context.Context) (sharedtypes.IRewardsFile, error)

func (*TreeGenerator) GenerateTreeWithRuleset

func (t *TreeGenerator) GenerateTreeWithRuleset(context context.Context, ruleset uint64) (sharedtypes.IRewardsFile, error)

func (*TreeGenerator) GetApproximatorRulesetVersion

func (t *TreeGenerator) GetApproximatorRulesetVersion() uint64

func (*TreeGenerator) GetGeneratorRulesetVersion

func (t *TreeGenerator) GetGeneratorRulesetVersion() uint64

Jump to

Keyboard shortcuts

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