Documentation
¶
Index ¶
- Constants
- Variables
- func BigToLittleEndian(input *big.Int) [32]byte
- func ConvertBytesToStrings(b [][32]byte) []string
- func ConvertTo32ByteArray(b []byte) [32]byte
- func ConvertUint64ToRoot(n uint64) phase0.Root
- func ExtractBlockCapella(blockHeaderFile string) (capella.BeaconBlock, error)
- func ExtractBlockDeneb(blockHeaderFile string) (deneb.BeaconBlock, error)
- func ExtractBlockHeader(blockHeaderFile string) (phase0.BeaconBlockHeader, error)
- func GetDepth(d uint64) uint8
- func GetSlotTimestamp(beaconState *spec.VersionedBeaconState, blockHeader *phase0.BeaconBlockHeader) (uint64, error)
- func GetValidatorFields(v *phase0.Validator) []string
- func GetWithdrawalFields(w *capella.Withdrawal) []string
- func GetWithdrawalIndex(validatorIndex uint64, withdrawals []*capella.Withdrawal) uint64
- func IsProvableWithdrawal(latestOracleBeaconSlot, withdrawalSlot uint64) bool
- func NextPowerOfTwo(v uint64) uint
- func ParseCapellaBeaconStateFromJSON(data beaconStateJSONCapella, s *capella.BeaconState) error
- func ParseCapellaStateJSONFile(filePath string) (*beaconStateJSONCapella, error)
- func ParseDenebBeaconStateFromJSON(data beaconStateJSONDeneb, s *deneb.BeaconState) error
- func ParseDenebStateJSONFile(filePath string) (*beaconStateJSONDeneb, error)
- func ParseJSONFileCapella(filePath string) (*beaconStateJSONCapella, error)
- func ParseJSONFileDeneb(filePath string) (*beaconStateJSONDeneb, error)
- type BalanceUpdateProofs
- type Bytes32
- type ChainClient
- func (c *ChainClient) EnsureTransactionEvaled(tx *types.Transaction, tag string) (*types.Receipt, error)
- func (c *ChainClient) EstimateGasPriceAndLimitAndSendTx(ctx context.Context, tx *types.Transaction, tag string) (*types.Receipt, error)
- func (c *ChainClient) GetAccountAddress() common.Address
- func (c *ChainClient) GetCurrentBlockNumber(ctx context.Context) (uint32, error)
- func (c *ChainClient) GetNoSendTransactOpts() *bind.TransactOpts
- type EigenPodProofs
- func (epp *EigenPodProofs) ComputeBeaconStateRoot(beaconState *deneb.BeaconState) (phase0.Root, error)
- func (epp *EigenPodProofs) ComputeBeaconStateTopLevelRoots(beaconState *spec.VersionedBeaconState) (*beacon.BeaconStateTopLevelRoots, error)
- func (epp *EigenPodProofs) ComputeValidatorTree(slot phase0.Slot, validators []*phase0.Validator) ([][]phase0.Root, error)
- func (epp *EigenPodProofs) ComputeValidatorTreeCustomComputer(slot phase0.Slot, computer func() ([][]phase0.Root, error)) ([][]phase0.Root, error)
- func (epp *EigenPodProofs) ComputeVersionedBeaconStateTopLevelRoots(beaconState *spec.VersionedBeaconState) (*beacon.BeaconStateTopLevelRoots, error)
- func (epp *EigenPodProofs) GetWithdrawalProofParams(latestOracleBeaconSlot, withdrawalSlot uint64) (uint64, error)
- func (epp *EigenPodProofs) ProveValidatorAgainstBeaconState(beaconStateTopLevelRoots *beacon.BeaconStateTopLevelRoots, ...) (common.Proof, error)
- func (epp *EigenPodProofs) ProveValidatorAgainstValidatorList(slot phase0.Slot, validators []*phase0.Validator, validatorIndex uint64) (common.Proof, error)
- func (epp *EigenPodProofs) ProveValidatorContainers(oracleBlockHeader *phase0.BeaconBlockHeader, ...) (*VerifyValidatorFieldsCallParams, error)
- func (epp *EigenPodProofs) ProveWithdrawal(oracleBlockHeader *phase0.BeaconBlockHeader, ...) (*WithdrawalProof, []Bytes32, error)
- func (epp *EigenPodProofs) ProveWithdrawals(oracleBlockHeader *phase0.BeaconBlockHeader, ...) (*VerifyAndProcessWithdrawalCallParams, error)
- type InputDataBlockCapella
- type InputDataBlockDeneb
- type InputDataBlockHeader
- type StateRootProof
- type VerifyAndProcessWithdrawalCallParams
- type VerifyBalanceUpdatesCallParams
- type VerifyValidatorFieldsCallParams
- type VerifyWithdrawalCredentialsCallParams
- type WithdrawalCredentialProofs
- type WithdrawalProof
- type WithdrawalProofs
Constants ¶
const ( BEACON_STATE_ROOT_PREFIX = "BEACON_STATE_ROOT_" BEACON_STATE_TOP_LEVEL_ROOTS_PREFIX = "BEACON_STATE_TOP_LEVEL_ROOTS_" VALIDATOR_TREE_PREFIX = "VALIDATOR_TREE_" MAX_ORACLE_STATE_CACHE_SIZE = 2000000 )
const FIRST_CAPELLA_SLOT_GOERLI = uint64(5193728)
const FIRST_CAPELLA_SLOT_HOLESKY = uint64(8192)
const FIRST_CAPELLA_SLOT_MAINNET = uint64(6209536)
Variables ¶
Functions ¶
func BigToLittleEndian ¶
func ConvertBytesToStrings ¶
func ConvertTo32ByteArray ¶
func ConvertUint64ToRoot ¶
func ExtractBlockCapella ¶
func ExtractBlockCapella(blockHeaderFile string) (capella.BeaconBlock, error)
func ExtractBlockDeneb ¶
func ExtractBlockDeneb(blockHeaderFile string) (deneb.BeaconBlock, error)
func ExtractBlockHeader ¶
func ExtractBlockHeader(blockHeaderFile string) (phase0.BeaconBlockHeader, error)
func GetSlotTimestamp ¶
func GetSlotTimestamp(beaconState *spec.VersionedBeaconState, blockHeader *phase0.BeaconBlockHeader) (uint64, error)
func GetValidatorFields ¶
func GetWithdrawalFields ¶
func GetWithdrawalFields(w *capella.Withdrawal) []string
func GetWithdrawalIndex ¶
func GetWithdrawalIndex(validatorIndex uint64, withdrawals []*capella.Withdrawal) uint64
func IsProvableWithdrawal ¶
func NextPowerOfTwo ¶
func ParseCapellaBeaconStateFromJSON ¶
func ParseCapellaBeaconStateFromJSON(data beaconStateJSONCapella, s *capella.BeaconState) error
func ParseDenebBeaconStateFromJSON ¶
func ParseDenebBeaconStateFromJSON(data beaconStateJSONDeneb, s *deneb.BeaconState) error
nolint:gocyclo
func ParseDenebStateJSONFile ¶
func ParseJSONFileCapella ¶
func ParseJSONFileDeneb ¶
Types ¶
type BalanceUpdateProofs ¶
type BalanceUpdateProofs struct {
ValidatorIndex uint64 `json:"validatorIndex"`
BeaconStateRoot string `json:"beaconStateRoot"`
LatestBlockHeaderRoot string `json:"latestBlockHeaderRoot"`
StateRootAgainstLatestBlockHeaderProof []string `json:"StateRootAgainstLatestBlockHeaderProof"`
ValidatorFieldsProof []string `json:"WithdrawalCredentialProof"`
ValidatorFields []string `json:"ValidatorFields"`
}
type Bytes32 ¶
type Bytes32 [32]byte
func ConvertUint64ToBytes32 ¶
func ConvertWithdrawalToWithdrawalFields ¶
func ConvertWithdrawalToWithdrawalFields(w *capella.Withdrawal) []Bytes32
func (*Bytes32) MarshalJSON ¶
func (*Bytes32) UnmarshalJSON ¶
type ChainClient ¶
type ChainClient struct {
*ethclient.Client
AccountAddress common.Address
NoSendTransactOpts *bind.TransactOpts
Contracts map[common.Address]*bind.BoundContract
// contains filtered or unexported fields
}
func NewChainClient ¶
func NewChainClient(ethClient *ethclient.Client, privateKeyString string) (*ChainClient, error)
func (*ChainClient) EnsureTransactionEvaled ¶
func (c *ChainClient) EnsureTransactionEvaled(tx *types.Transaction, tag string) (*types.Receipt, error)
func (*ChainClient) EstimateGasPriceAndLimitAndSendTx ¶
func (c *ChainClient) EstimateGasPriceAndLimitAndSendTx( ctx context.Context, tx *types.Transaction, tag string, ) (*types.Receipt, error)
EstimateGasPriceAndLimitAndSendTx sends and returns an otherwise identical txn to the one provided but with updated gas prices sampled from the existing network conditions and an accurate gasLimit
Note: tx must be a to a contract, not an EOA
Slightly modified from: https://github.com/ethereum-optimism/optimism/blob/ec266098641820c50c39c31048aa4e953bece464/batch-submitter/drivers/sequencer/driver.go#L314
func (*ChainClient) GetAccountAddress ¶
func (c *ChainClient) GetAccountAddress() common.Address
func (*ChainClient) GetCurrentBlockNumber ¶
func (c *ChainClient) GetCurrentBlockNumber(ctx context.Context) (uint32, error)
func (*ChainClient) GetNoSendTransactOpts ¶
func (c *ChainClient) GetNoSendTransactOpts() *bind.TransactOpts
type EigenPodProofs ¶
type EigenPodProofs struct {
// contains filtered or unexported fields
}
func NewEigenPodProofs ¶
func NewEigenPodProofs(chainID uint64, oracleStateCacheExpirySeconds int) (*EigenPodProofs, error)
func (*EigenPodProofs) ComputeBeaconStateRoot ¶
func (epp *EigenPodProofs) ComputeBeaconStateRoot(beaconState *deneb.BeaconState) (phase0.Root, error)
func (*EigenPodProofs) ComputeBeaconStateTopLevelRoots ¶
func (epp *EigenPodProofs) ComputeBeaconStateTopLevelRoots(beaconState *spec.VersionedBeaconState) (*beacon.BeaconStateTopLevelRoots, error)
func (*EigenPodProofs) ComputeValidatorTree ¶
func (*EigenPodProofs) ComputeValidatorTreeCustomComputer ¶
func (*EigenPodProofs) ComputeVersionedBeaconStateTopLevelRoots ¶
func (epp *EigenPodProofs) ComputeVersionedBeaconStateTopLevelRoots(beaconState *spec.VersionedBeaconState) (*beacon.BeaconStateTopLevelRoots, error)
func (*EigenPodProofs) GetWithdrawalProofParams ¶
func (epp *EigenPodProofs) GetWithdrawalProofParams(latestOracleBeaconSlot, withdrawalSlot uint64) (uint64, error)
func (*EigenPodProofs) ProveValidatorAgainstBeaconState ¶
func (*EigenPodProofs) ProveValidatorAgainstValidatorList ¶
func (*EigenPodProofs) ProveValidatorContainers ¶
func (epp *EigenPodProofs) ProveValidatorContainers(oracleBlockHeader *phase0.BeaconBlockHeader, oracleBeaconState *spec.VersionedBeaconState, validatorIndices []uint64) (*VerifyValidatorFieldsCallParams, error)
func (*EigenPodProofs) ProveWithdrawal ¶
func (epp *EigenPodProofs) ProveWithdrawal( oracleBlockHeader *phase0.BeaconBlockHeader, oracleBeaconState *spec.VersionedBeaconState, oracleBeaconStateTopLevelRoots *beacon.BeaconStateTopLevelRoots, historicalSummaryStateBlockRoots []phase0.Root, withdrawalBlock *spec.VersionedSignedBeaconBlock, validatorIndex uint64, ) (*WithdrawalProof, []Bytes32, error)
ProveWithdrawal generates the proofs required to prove a withdrawal oracleBlockHeader: the root of this is provided by the oracle, we prove the state root against this oracleBeaconState: the state of the block header provided by the oracle historicalSummaryState: the state whose slot at which historicalSummaryState.block_roots was hashed and added to historical_summaries withdrawalBlock: the block containing the withdrawal validatorIndex: the index of the validator that the withdrawal happened for
func (*EigenPodProofs) ProveWithdrawals ¶
func (epp *EigenPodProofs) ProveWithdrawals( oracleBlockHeader *phase0.BeaconBlockHeader, oracleBeaconState *spec.VersionedBeaconState, historicalSummaryStateBlockRoots [][]phase0.Root, withdrawalBlocks []*spec.VersionedSignedBeaconBlock, validatorIndices []uint64, ) (*VerifyAndProcessWithdrawalCallParams, error)
type InputDataBlockCapella ¶
type InputDataBlockDeneb ¶
type InputDataBlockHeader ¶
type InputDataBlockHeader struct {
Data struct {
Header struct {
Message phase0.BeaconBlockHeader `json:"message"`
} `json:"header"`
} `json:"data"`
}
type StateRootProof ¶
type StateRootProof struct {
BeaconStateRoot phase0.Root `json:"beaconStateRoot"`
StateRootProof common.Proof `json:"stateRootProof"`
Slot phase0.Slot `json:"slot"`
SlotRootProof common.Proof `json:"slotRootProof"` //Note: this slot root is oracle block root being used to prove partial withdrawals is after the specified range of blocks requested by the user
}
func ProveValidatorFields ¶
func ProveValidatorFields(epp *EigenPodProofs, oracleBlockHeader *phase0.BeaconBlockHeader, oracleBeaconState *spec.VersionedBeaconState, validatorIndex uint64) (*StateRootProof, common.Proof, error)
type VerifyAndProcessWithdrawalCallParams ¶
type VerifyAndProcessWithdrawalCallParams struct {
OracleTimestamp uint64 `json:"oracleTimestamp"`
StateRootProof *StateRootProof `json:"stateRootProof"`
WithdrawalProofs []*WithdrawalProof `json:"withdrawalProofs"`
ValidatorFieldsProofs []common.Proof `json:"validatorFieldsProofs"`
ValidatorFields [][]Bytes32 `json:"validatorFields"`
WithdrawalFields [][]Bytes32 `json:"withdrawalFields"`
}
type VerifyBalanceUpdatesCallParams ¶
type VerifyBalanceUpdatesCallParams = VerifyValidatorFieldsCallParams
type VerifyValidatorFieldsCallParams ¶
type VerifyValidatorFieldsCallParams struct {
OracleTimestamp uint64 `json:"oracleTimestamp"`
StateRootProof *StateRootProof `json:"stateRootProof"`
ValidatorIndices []uint64 `json:"validatorIndices"`
ValidatorFieldsProofs []common.Proof `json:"validatorFieldsProofs"`
ValidatorFields [][]Bytes32 `json:"validatorFields"`
}
type VerifyWithdrawalCredentialsCallParams ¶
type VerifyWithdrawalCredentialsCallParams = VerifyValidatorFieldsCallParams
We define these two aliases here, since calls to verifyWithdrawalCredentials and verifyBalanceUpdates use the same inputs
type WithdrawalCredentialProofs ¶
type WithdrawalCredentialProofs struct {
StateRootAgainstLatestBlockHeaderProof []string `json:"StateRootAgainstLatestBlockHeaderProof"`
BeaconStateRoot string `json:"beaconStateRoot"`
ValidatorIndex uint64 `json:"validatorIndex"`
WithdrawalCredentialProof []string `json:"WithdrawalCredentialProof"`
ValidatorFields []string `json:"ValidatorFields"`
}
type WithdrawalProof ¶
type WithdrawalProof struct {
WithdrawalProof common.Proof `json:"withdrawalProof"`
SlotProof common.Proof `json:"slotProof"`
ExecutionPayloadProof common.Proof `json:"executionPayloadProof"`
TimestampProof common.Proof `json:"timestampProof"`
HistoricalSummaryBlockRootProof common.Proof `json:"historicalSummaryBlockRootProof"`
BlockRootIndex uint64 `json:"blockRootIndex"`
HistoricalSummaryIndex uint64 `json:"historicalSummaryIndex"`
WithdrawalIndex uint64 `json:"withdrawalIndex"`
BlockRoot phase0.Root `json:"blockRoot"`
SlotRoot phase0.Root `json:"slotRoot"`
TimestampRoot phase0.Root `json:"timestampRoot"`
ExecutionPayloadRoot phase0.Root `json:"executionPayloadRoot"`
}
type WithdrawalProofs ¶
type WithdrawalProofs struct {
StateRootAgainstLatestBlockHeaderProof []string `json:"StateRootAgainstLatestBlockHeaderProof"`
SlotAgainstLatestBlockHeaderProof []string `json:"SlotAgainstLatestBlockHeaderProof"`
BeaconStateRoot string `json:"beaconStateRoot"`
WithdrawalProof []string `json:"WithdrawalProof"`
SlotProof []string `json:"SlotProof"`
ExecutionPayloadProof []string `json:"ExecutionPayloadProof"`
TimestampProof []string `json:"TimestampProof"`
HistoricalSummaryProof []string `json:"HistoricalSummaryProof"`
BlockHeaderRootIndex uint64 `json:"blockHeaderRootIndex"`
HistoricalSummaryIndex uint64 `json:"historicalSummaryIndex"`
WithdrawalIndex uint64 `json:"withdrawalIndex"`
BlockHeaderRoot string `json:"blockHeaderRoot"`
SlotRoot string `json:"slotRoot"`
TimestampRoot string `json:"timestampRoot"`
ExecutionPayloadRoot string `json:"executionPayloadRoot"`
ValidatorProof []string `json:"ValidatorProof"`
ValidatorFields []string `json:"ValidatorFields"`
WithdrawalFields []string `json:"WithdrawalFields"`
}