Documentation
¶
Index ¶
- Constants
- Variables
- func AllZero(s []byte) bool
- func CastBalanceProofs(proofs []*eigenpodproofs.BalanceProof) []EigenPod.BeaconChainProofsBalanceProof
- func CastValidatorFields(proof [][]eigenpodproofs.Bytes32) [][][32]byte
- func Chunk[T any](arr []T, chunkSize uint64) [][]T
- func ContextWithTracing(ctx context.Context, callbacks *TracerCallbacks) context.Context
- func CurrentConsolidationFee(client *ethclient.Client) (*big.Int, error)
- func CurrentWithdrawalFee(client *ethclient.Client) (*big.Int, error)
- func FetchMultipleOnchainValidatorInfoMulticalls(eigenpodAddress string, allValidators []*phase0.Validator) ([]*multicall.MultiCallMetaData[EigenPod.IEigenPodTypesValidatorInfo], error)
- func ForkVersions() map[uint64]string
- func GetBeaconHeadState(ctx context.Context, beaconClient BeaconClient) (*spec.VersionedBeaconState, error)
- func GetCheckpointTimestampAndBeaconState(ctx context.Context, eigenpodAddress string, eth *ethclient.Client, ...) (uint64, *spec.VersionedBeaconState, error)
- func GetCurrentCheckpoint(eigenpodAddress string, client *ethclient.Client) (uint64, error)
- func GetCurrentCheckpointBlockRoot(eigenpodAddress string, eth *ethclient.Client) (*[32]byte, error)
- func GetEigenPodValidatorsByIndex(eigenpodAddress string, beaconState *spec.VersionedBeaconState) (map[uint64]*phase0.Validator, error)
- func GetEthClient(ctx context.Context, node string) (*ethclient.Client, *big.Int, error)
- func GetExcessConsolidationRequests(client *ethclient.Client) (*big.Int, error)
- func GetExcessWithdrawalRequests(client *ethclient.Client) (*big.Int, error)
- func GweiToEther(val *big.Float) *big.Float
- func GweiToWei(val *big.Float) *big.Float
- func IGweiToWei(val *big.Int) *big.Int
- func IsAwaitingWithdrawalCredentialProof(validatorInfo EigenPod.IEigenPodTypesValidatorInfo, ...) bool
- func IweiToEther(val *big.Int) *big.Float
- func Panic(message string)
- func PanicIfNoConsent(prompt string)
- func PanicOnError(message string, err error)
- func SortByStatus(validators map[string]Validator) ([]Validator, []Validator, []Validator, []Validator)
- func StartCheckpoint(ctx context.Context, eigenpodAddress string, ownerPrivateKey string, ...) (*types.Transaction, error)
- func StartCheckpointProofConsent() string
- func SubmitCredentialsProofConsent(numTransactions int) string
- func SubmitFullExitRequestConsent(numRequests int, currentQueueSize *big.Int, currentFee string, totalFee string, ...) string
- func SubmitPartialExitRequestConsent(numRequests int, currentQueueSize *big.Int, currentFee string, totalFee string, ...) string
- func SubmitSourceToTargetRequestConsent(numRequests int, currentQueueSize *big.Int, currentFee string, totalFee string, ...) string
- func SubmitSwitchRequestConsent(numRequests int, currentQueueSize *big.Int, currentFee string, totalFee string, ...) string
- func Uint64ArrayToBigIntArray(nums []uint64) []*big.Int
- func WeiToGwei(val *big.Int) *big.Float
- func WriteOutputToFileOrStdout(output []byte, out *string) error
- type BeaconClient
- func GetBeaconClient(beaconUri string, verbose bool) (BeaconClient, error)
- func GetClients(ctx context.Context, node, beaconNodeUri string, enableLogs bool) (*ethclient.Client, BeaconClient, *big.Int, error)
- func NewBeaconClient(endpoint string, verbose bool) (BeaconClient, context.CancelFunc, error)
- type Checkpoint
- type ConsolidatableValidatorSet
- type Owner
- type Predeploy
- type PredeployFeeInfo
- func EstimateConsolidationFeePerChunk(client *ethclient.Client, ...) ([]*PredeployFeeInfo, error)
- func EstimateWithdrawalFeePerChunk(client *ethclient.Client, ...) ([]*PredeployFeeInfo, error)
- func GetConsolidationFeeInfoForRequest(client *ethclient.Client, ...) (*PredeployFeeInfo, error)
- func GetWithdrawalFeeInfoForRequest(client *ethclient.Client, request []EigenPod.IEigenPodTypesWithdrawalRequest, ...) (*PredeployFeeInfo, error)
- type TEigenKey
- type TracerCallbacks
- type Validator
- type ValidatorWithIndex
- type ValidatorWithMaybeOnchainInfo
- type ValidatorWithOnchainInfo
- func FetchMultipleOnchainValidatorInfo(ctx context.Context, client *ethclient.Client, eigenpodAddress string, ...) ([]ValidatorWithOnchainInfo, error)
- func SelectActiveValidators(client *ethclient.Client, eigenpodAddress string, ...) ([]ValidatorWithOnchainInfo, error)
- func SelectAwaitingActivationValidators(client *ethclient.Client, eigenpodAddress string, ...) ([]ValidatorWithOnchainInfo, error)
- func SelectAwaitingCredentialValidators(client *ethclient.Client, eigenpodAddress string, ...) ([]ValidatorWithOnchainInfo, error)
- func SelectCheckpointableValidators(client *ethclient.Client, eigenpodAddress string, ...) ([]ValidatorWithOnchainInfo, error)
Constants ¶
const ( ValidatorStatusInactive = 0 ValidatorStatusActive = 1 ValidatorStatusWithdrawn = 2 )
const ( BLSWithdrawalPrefix = 0 ETH1WithdrawalPrefix = 1 CompoundingWithdrawalPrefix = 2 )
const FAR_FUTURE_EPOCH = math.MaxUint64
Variables ¶
var ( ErrNoEigenPod = errors.New("no eigenpod associated with owner") ErrBeaconClientNotSupported = errors.New("could not instantiate beacon chain client") ErrValidatorNotFound = errors.New("validator not found") )
var ( CONSOLIDATION_PREDEPLOY = common.HexToAddress("0x0000BBdDc7CE488642fb579F8B00f3a590007251") WITHDRAWAL_PREDEPLOY = common.HexToAddress("0x00000961Ef480Eb55e80D19ad83579A64c007002") // 2**256 - 1 EXCESS_INHIBITOR = new(big.Int).Sub( new(big.Int).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1), ) // Consolidation constants MAX_CONSOLIDATION_REQUESTS_PER_BLOCK = big.NewInt(2) MIN_CONSOLIDATION_REQUEST_FEE = big.NewInt(1) CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION = big.NewInt(17) // Withdrawal constants MAX_WITHDRAWAL_REQUESTS_PER_BLOCK = big.NewInt(16) MIN_WITHDRAWAL_REQUEST_FEE = big.NewInt(1) WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION = big.NewInt(17) )
Constants defined in predeploy EIPs: - EIP-7521: https://eips.ethereum.org/EIPS/eip-7251#constants - EIP-7002: https://eips.ethereum.org/EIPS/eip-7002#configuration
Functions ¶
func CastBalanceProofs ¶
func CastBalanceProofs(proofs []*eigenpodproofs.BalanceProof) []EigenPod.BeaconChainProofsBalanceProof
func CastValidatorFields ¶
func CastValidatorFields(proof [][]eigenpodproofs.Bytes32) [][][32]byte
golang was a mistake. these types are literally identical :'(
func ContextWithTracing ¶
func ContextWithTracing(ctx context.Context, callbacks *TracerCallbacks) context.Context
func CurrentConsolidationFee ¶
CurrentConsolidationFee queries the EIP-7521 predeploy to get the current per-request fee in wei
func CurrentWithdrawalFee ¶
CurrentWithdrawalFee queries the EIP-7002 predeploy to get the current per-request fee in wei
func ForkVersions ¶
this is a mapping from <chainId, genesis_fork_version>.
func GetBeaconHeadState ¶
func GetBeaconHeadState(ctx context.Context, beaconClient BeaconClient) (*spec.VersionedBeaconState, error)
func GetCheckpointTimestampAndBeaconState ¶
func GetCheckpointTimestampAndBeaconState( ctx context.Context, eigenpodAddress string, eth *ethclient.Client, beaconClient BeaconClient, ) (uint64, *spec.VersionedBeaconState, error)
Fetch and return the current checkpoint timestamp for the pod If the checkpoint exists (timestamp != 0), also return the beacon state for the checkpoint If the checkpoint does not exist (timestamp == 0), return the head beacon state (i.e. the state we would use "if we start a checkpoint now")
func GetCurrentCheckpoint ¶
func GetEigenPodValidatorsByIndex ¶
func GetEigenPodValidatorsByIndex( eigenpodAddress string, beaconState *spec.VersionedBeaconState, ) (map[uint64]*phase0.Validator, error)
GetEigenPodValidatorsByIndex looks up all validators for an eigenpod and returns a map from validator index to validator info
func GetEthClient ¶
func GetExcessConsolidationRequests ¶
GetExcessConsolidationRequests reads EIP-7521 predeploy storage slot 0 to get the number of excess requests currently in the queue.
func GetExcessWithdrawalRequests ¶
GetExcessConsolidationRequests reads EIP-7002 predeploy storage slot 0 to get the number of excess requests currently in the queue.
func IsAwaitingWithdrawalCredentialProof ¶
func IsAwaitingWithdrawalCredentialProof(validatorInfo EigenPod.IEigenPodTypesValidatorInfo, validator *phase0.Validator) bool
func PanicIfNoConsent ¶
func PanicIfNoConsent(prompt string)
func PanicOnError ¶
func SortByStatus ¶
func StartCheckpoint ¶
func StartCheckpointProofConsent ¶
func StartCheckpointProofConsent() string
Types ¶
type BeaconClient ¶
type BeaconClient interface { GetBeaconHeader(ctx context.Context, blockId string) (*v1.BeaconBlockHeader, error) GetBeaconState(ctx context.Context, stateId string) (*spec.VersionedBeaconState, error) GetValidator(ctx context.Context, index uint64) (*v1.Validator, error) GetGenesisForkVersion(ctx context.Context) (*phase0.Version, error) }
func GetBeaconClient ¶
func GetBeaconClient(beaconUri string, verbose bool) (BeaconClient, error)
func GetClients ¶
func NewBeaconClient ¶
func NewBeaconClient(endpoint string, verbose bool) (BeaconClient, context.CancelFunc, error)
type Checkpoint ¶
type ConsolidatableValidatorSet ¶
type ConsolidatableValidatorSet struct { Sources []ValidatorWithIndex Targets []ValidatorWithIndex }
type Owner ¶
type PredeployFeeInfo ¶
type PredeployFeeInfo struct { CurrentQueueSize *big.Int FeePerRequest *big.Int TotalFee *big.Int OverestimateFee *big.Int }
func EstimateConsolidationFeePerChunk ¶
func EstimateConsolidationFeePerChunk( client *ethclient.Client, requestChunks [][]EigenPod.IEigenPodTypesConsolidationRequest, ) ([]*PredeployFeeInfo, error)
EstimateConsolidationFeePerChunk estimates the consolidation fee required to submit multiple "chunks" of consolidation requests. This method assumes the requests are submitted in sequential blocks, with the system address updating the fee between each block.
The returned array is the "fee per request" for each chunk
func EstimateWithdrawalFeePerChunk ¶
func EstimateWithdrawalFeePerChunk( client *ethclient.Client, requestChunks [][]EigenPod.IEigenPodTypesWithdrawalRequest, ) ([]*PredeployFeeInfo, error)
EstimateWithdrawalFeePerChunk estimates the withdrawal fee required to submit multiple "chunks" of withdrawal requests. This method assumes the requests are submitted in sequential blocks, with the system address updating the fee between each block.
The returned array is the "fee per request" for each chunk
func GetConsolidationFeeInfoForRequest ¶
func GetConsolidationFeeInfoForRequest( client *ethclient.Client, request []EigenPod.IEigenPodTypesConsolidationRequest, overestimateFactor float64, ) (*PredeployFeeInfo, error)
GetConsolidationFeeInfoForRequest retrieves info on the current fees required to submit consolidation requests.
func GetWithdrawalFeeInfoForRequest ¶
func GetWithdrawalFeeInfoForRequest( client *ethclient.Client, request []EigenPod.IEigenPodTypesWithdrawalRequest, overestimateFactor float64, ) (*PredeployFeeInfo, error)
GetWithdrawalFeeInfoForRequest retrieves info on the current fees required to submit withdrawal requests.
type TracerCallbacks ¶
type TracerCallbacks struct { OnStartSection func(name string, metadata map[string]string) OnEndSection func() }
func GetContextTracingCallbacks ¶
func GetContextTracingCallbacks(ctx context.Context) *TracerCallbacks
type ValidatorWithIndex ¶
func FindAllValidatorsForEigenpod ¶
func FindAllValidatorsForEigenpod(eigenpodAddress string, beaconState *spec.VersionedBeaconState) ([]ValidatorWithIndex, error)
search through beacon state for validators whose withdrawal address is set to eigenpod.
type ValidatorWithMaybeOnchainInfo ¶
type ValidatorWithMaybeOnchainInfo = struct { Info *EigenPod.IEigenPodTypesValidatorInfo Validator *phase0.Validator Index uint64 }
func FetchMultipleOnchainValidatorInfoWithFailures ¶
func FetchMultipleOnchainValidatorInfoWithFailures(ctx context.Context, client *ethclient.Client, eigenpodAddress string, allValidators []ValidatorWithIndex) ([]ValidatorWithMaybeOnchainInfo, error)
type ValidatorWithOnchainInfo ¶
type ValidatorWithOnchainInfo = struct { Info EigenPod.IEigenPodTypesValidatorInfo Validator *phase0.Validator Index uint64 }
func FetchMultipleOnchainValidatorInfo ¶
func FetchMultipleOnchainValidatorInfo(ctx context.Context, client *ethclient.Client, eigenpodAddress string, allValidators []ValidatorWithIndex) ([]ValidatorWithOnchainInfo, error)
func SelectActiveValidators ¶
func SelectActiveValidators( client *ethclient.Client, eigenpodAddress string, validators []ValidatorWithOnchainInfo, ) ([]ValidatorWithOnchainInfo, error)
func SelectAwaitingActivationValidators ¶
func SelectAwaitingActivationValidators( client *ethclient.Client, eigenpodAddress string, validators []ValidatorWithOnchainInfo, ) ([]ValidatorWithOnchainInfo, error)
Validators whose deposits have been processed but are awaiting activation on the beacon chain If the validator has 32 ETH effective balance, they should
func SelectAwaitingCredentialValidators ¶
func SelectAwaitingCredentialValidators( client *ethclient.Client, eigenpodAddress string, validators []ValidatorWithOnchainInfo, ) ([]ValidatorWithOnchainInfo, error)
func SelectCheckpointableValidators ¶
func SelectCheckpointableValidators( client *ethclient.Client, eigenpodAddress string, validators []ValidatorWithOnchainInfo, lastCheckpoint uint64, ) ([]ValidatorWithOnchainInfo, error)