Documentation ¶
Index ¶
- Variables
- func GenerateProofDB(proof []string) *proofDB
- func ParseWithdrawalInitiated(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiated, error)
- func StorageSlotOfWithdrawalHash(hash common.Hash) common.Hash
- func VerifyAccountProof(root common.Hash, address common.Address, account types.StateAccount, ...) error
- func VerifyProof(stateRoot common.Hash, proof *gethclient.AccountResult) error
- func VerifyStorageProof(root common.Hash, proof gethclient.StorageResult) error
- func WaitForFinalizationPeriod(ctx context.Context, client *ethclient.Client, portalAddr common.Address, ...) (uint64, error)
- func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common.Hash, error)
- type Client
- type FinalizedWithdrawalParameters
- type ProofClient
Constants ¶
This section is empty.
Variables ¶
var (
Uint256Type, _ = abi.NewType("uint256", "", nil)
BytesType, _ = abi.NewType("bytes", "", nil)
AddressType, _ = abi.NewType("address", "", nil)
)
Standard ABI types copied from golang ABI tests
Functions ¶
func GenerateProofDB ¶
func GenerateProofDB(proof []string) *proofDB
func ParseWithdrawalInitiated ¶ added in v0.3.0
func ParseWithdrawalInitiated(receipt *types.Receipt) (*bindings.L2ToL1MessagePasserWithdrawalInitiated, error)
ParseWithdrawalInitiated parses
func StorageSlotOfWithdrawalHash ¶
StorageSlotOfWithdrawalHash determines the storage slot of the Withdrawer contract to look at given a WithdrawalHash
func VerifyAccountProof ¶
func VerifyProof ¶
func VerifyProof(stateRoot common.Hash, proof *gethclient.AccountResult) error
func VerifyStorageProof ¶
func VerifyStorageProof(root common.Hash, proof gethclient.StorageResult) error
func WaitForFinalizationPeriod ¶
func WaitForFinalizationPeriod(ctx context.Context, client *ethclient.Client, portalAddr common.Address, l2BlockNumber *big.Int) (uint64, error)
WaitForFinalizationPeriod waits until there is OutputProof for an L2 block number larger than the supplied l2BlockNumber and that the output is finalized. This functions polls and can block for a very long time if used on mainnet. This returns the block number to use for the proof generation.
func WithdrawalHash ¶
func WithdrawalHash(ev *bindings.L2ToL1MessagePasserWithdrawalInitiated) (common.Hash, error)
WithdrawalHash computes the hash of the withdrawal that was stored in the L2 withdrawal contract state. TODO:
- I don't like having to use the ABI Generated struct
- There should be a better way to run the ABI encoding
- These needs to be fuzzed against the solidity
Types ¶
type FinalizedWithdrawalParameters ¶ added in v0.3.0
type FinalizedWithdrawalParameters struct { Nonce *big.Int Sender common.Address Target common.Address Value *big.Int GasLimit *big.Int BlockNumber *big.Int Data []byte OutputRootProof bindings.HashingOutputRootProof WithdrawalProof []byte // RLP Encoded list of trie nodes to prove L2 storage }
FinalizedWithdrawalParameters is the set of parameters to pass to the FinalizedWithdrawal function
func FinalizeWithdrawalParameters ¶ added in v0.3.0
func FinalizeWithdrawalParameters(ctx context.Context, l2client ProofClient, txHash common.Hash, header *types.Header) (FinalizedWithdrawalParameters, error)
FinalizeWithdrawalParameters queries L2 to generate all withdrawal parameters and proof necessary to finalize an withdrawal on L1. The header provided is very important. It should be a block (timestamp) for which there is a submitted output in the L2 Output Oracle contract. If not, the withdrawal will fail as it the storage proof cannot be verified if there is no submitted state root.