Documentation ¶
Index ¶
- Variables
- func SequencedBatchesSigHash() common.Hash
- func TrustedVerifyBatchesSigHash() common.Hash
- type Block
- type Client
- func (etherMan *Client) AddOrReplaceAuth(auth bind.TransactOpts) error
- func (etherMan *Client) ApproveMatic(ctx context.Context, account common.Address, maticAmount *big.Int, ...) (*types.Transaction, error)
- func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence) (to *common.Address, data []byte, err error)
- func (etherMan *Client) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, ...) (to *common.Address, data []byte, err error)
- func (etherMan *Client) CheckTxWasMined(ctx context.Context, txHash common.Hash) (bool, *types.Receipt, error)
- func (etherMan *Client) CurrentNonce(ctx context.Context, account common.Address) (uint64, error)
- func (etherMan *Client) EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, ...) (uint64, error)
- func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence) (*types.Transaction, error)
- func (etherMan *Client) EthBlockByNumber(ctx context.Context, blockNumber uint64) (*types.Block, error)
- func (etherMan *Client) GetForks(ctx context.Context) ([]state.ForkIDInterval, error)
- func (etherMan *Client) GetL1GasPrice(ctx context.Context) *big.Int
- func (etherMan *Client) GetL2ChainID() (uint64, error)
- func (etherMan *Client) GetL2ForkID() (uint64, error)
- func (etherMan *Client) GetL2ForkIDIntervals() ([]state.ForkIDInterval, error)
- func (etherMan *Client) GetLastBatchTimestamp() (uint64, error)
- func (etherMan *Client) GetLatestBatchNumber() (uint64, error)
- func (etherMan *Client) GetLatestBlockNumber(ctx context.Context) (uint64, error)
- func (etherMan *Client) GetLatestBlockTimestamp(ctx context.Context) (uint64, error)
- func (etherMan *Client) GetLatestVerifiedBatchNum() (uint64, error)
- func (etherMan *Client) GetRevertMessage(ctx context.Context, tx *types.Transaction) (string, error)
- func (etherMan *Client) GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]Block, map[common.Hash][]Order, error)
- func (etherMan *Client) GetSendSequenceFee(numBatches uint64) (*big.Int, error)
- func (etherMan *Client) GetTrustedSequencerURL() (string, error)
- func (etherMan *Client) GetTx(ctx context.Context, txHash common.Hash) (*types.Transaction, bool, error)
- func (etherMan *Client) GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (etherMan *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, error)
- func (etherMan *Client) SendTx(ctx context.Context, tx *types.Transaction) error
- func (etherMan *Client) SignTx(ctx context.Context, sender common.Address, tx *types.Transaction) (*types.Transaction, error)
- func (etherMan *Client) SuggestedGasPrice(ctx context.Context) (*big.Int, error)
- func (etherMan *Client) TrustedSequencer() (common.Address, error)
- func (etherMan *Client) VerifyGenBlockNumber(ctx context.Context, genBlockNumber uint64) (bool, error)
- func (etherMan *Client) WaitTxToBeMined(ctx context.Context, tx *types.Transaction, timeout time.Duration) (bool, error)
- type Config
- type EventOrder
- type ForcedBatch
- type ForkID
- type GlobalExitRoot
- type L1Config
- type Order
- type SequencedBatch
- type SequencedForceBatch
- type VerifiedBatch
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGasRequiredExceedsAllowance gas required exceeds the allowance ErrGasRequiredExceedsAllowance = errors.New("gas required exceeds allowance") // ErrContentLengthTooLarge content length is too large ErrContentLengthTooLarge = errors.New("content length too large") //ErrTimestampMustBeInsideRange Timestamp must be inside range ErrTimestampMustBeInsideRange = errors.New("timestamp must be inside range") //ErrInsufficientAllowance insufficient allowance ErrInsufficientAllowance = errors.New("insufficient allowance") // ErrBothGasPriceAndMaxFeeGasAreSpecified both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified ErrBothGasPriceAndMaxFeeGasAreSpecified = errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") // ErrMaxFeeGasAreSpecifiedButLondonNotActive maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet ErrMaxFeeGasAreSpecifiedButLondonNotActive = errors.New("maxFeePerGas or maxPriorityFeePerGas specified but london is not active yet") // ErrNoSigner no signer to authorize the transaction with ErrNoSigner = errors.New("no signer to authorize the transaction with") // ErrMissingTrieNode means that a node is missing on the trie ErrMissingTrieNode = errors.New("missing trie node") )
var ( // ErrNotFound is used when the object is not found ErrNotFound = errors.New("not found") // ErrIsReadOnlyMode is used when the EtherMan client is in read-only mode. ErrIsReadOnlyMode = errors.New("etherman client in read-only mode: no account configured to send transactions to L1. " + "please check the [Etherman] PrivateKeyPath and PrivateKeyPassword configuration") // ErrPrivateKeyNotFound used when the provided sender does not have a private key registered to be used ErrPrivateKeyNotFound = errors.New("can't find sender private key to sign tx") )
Functions ¶
func SequencedBatchesSigHash ¶
SequencedBatchesSigHash returns the hash for the `SequenceBatches` event.
func TrustedVerifyBatchesSigHash ¶
TrustedVerifyBatchesSigHash returns the hash for the `TrustedVerifyBatches` event.
Types ¶
type Block ¶
type Block struct { BlockNumber uint64 BlockHash common.Hash ParentHash common.Hash GlobalExitRoots []GlobalExitRoot ForcedBatches []ForcedBatch SequencedBatches [][]SequencedBatch VerifiedBatches []VerifiedBatch SequencedForceBatches [][]SequencedForceBatch ForkIDs []ForkID ReceivedAt time.Time }
Block struct
type Client ¶
type Client struct { EthClient ethereumClient ZkEVM *polygonzkevm.Polygonzkevm GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot Matic *matic.Matic SCAddresses []common.Address GasProviders externalGasProviders // contains filtered or unexported fields }
Client is a simple implementation of EtherMan.
func NewSimulatedEtherman ¶
func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts) (etherman *Client, ethBackend *backends.SimulatedBackend, maticAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, err error)
NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth must be 1337. The address that holds the auth will have an initial balance of 10 ETH
func (*Client) AddOrReplaceAuth ¶
func (etherMan *Client) AddOrReplaceAuth(auth bind.TransactOpts) error
AddOrReplaceAuth adds an authorization or replace an existent one to the same account
func (*Client) ApproveMatic ¶
func (etherMan *Client) ApproveMatic(ctx context.Context, account common.Address, maticAmount *big.Int, to common.Address) (*types.Transaction, error)
ApproveMatic function allow to approve tokens in matic smc
func (*Client) BuildSequenceBatchesTxData ¶
func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence) (to *common.Address, data []byte, err error)
BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches.
func (*Client) BuildTrustedVerifyBatchesTxData ¶
func (etherMan *Client) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs) (to *common.Address, data []byte, err error)
BuildTrustedVerifyBatchesTxData builds a []bytes to be sent to the PoE SC method TrustedVerifyBatches.
func (*Client) CheckTxWasMined ¶
func (etherMan *Client) CheckTxWasMined(ctx context.Context, txHash common.Hash) (bool, *types.Receipt, error)
CheckTxWasMined check if a tx was already mined
func (*Client) CurrentNonce ¶
CurrentNonce returns the current nonce for the provided account
func (*Client) EstimateGas ¶
func (etherMan *Client) EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte) (uint64, error)
EstimateGas returns the estimated gas for the tx
func (*Client) EstimateGasSequenceBatches ¶
func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence) (*types.Transaction, error)
EstimateGasSequenceBatches estimates gas for sending batches
func (*Client) EthBlockByNumber ¶
func (etherMan *Client) EthBlockByNumber(ctx context.Context, blockNumber uint64) (*types.Block, error)
EthBlockByNumber function retrieves the ethereum block information by ethereum block number.
func (*Client) GetL1GasPrice ¶
GetL1GasPrice gets the l1 gas price
func (*Client) GetL2ChainID ¶
GetL2ChainID returns L2 Chain ID
func (*Client) GetL2ForkID ¶
GetL2ForkID returns current L2 Fork ID
func (*Client) GetL2ForkIDIntervals ¶
func (etherMan *Client) GetL2ForkIDIntervals() ([]state.ForkIDInterval, error)
GetL2ForkIDIntervals return L2 Fork ID intervals
func (*Client) GetLastBatchTimestamp ¶
GetLastBatchTimestamp function allows to retrieve the lastTimestamp value in the smc
func (*Client) GetLatestBatchNumber ¶
GetLatestBatchNumber function allows to retrieve the latest proposed batch in the smc
func (*Client) GetLatestBlockNumber ¶
GetLatestBlockNumber gets the latest block number from the ethereum
func (*Client) GetLatestBlockTimestamp ¶
GetLatestBlockTimestamp gets the latest block timestamp from the ethereum
func (*Client) GetLatestVerifiedBatchNum ¶
GetLatestVerifiedBatchNum gets latest verified batch from ethereum
func (*Client) GetRevertMessage ¶
func (etherMan *Client) GetRevertMessage(ctx context.Context, tx *types.Transaction) (string, error)
GetRevertMessage tries to get a revert message of a transaction
func (*Client) GetRollupInfoByBlockRange ¶
func (etherMan *Client) GetRollupInfoByBlockRange(ctx context.Context, fromBlock uint64, toBlock *uint64) ([]Block, map[common.Hash][]Order, error)
GetRollupInfoByBlockRange function retrieves the Rollup information that are included in all this ethereum blocks from block x to block y.
func (*Client) GetSendSequenceFee ¶
GetSendSequenceFee get super/trusted sequencer fee
func (*Client) GetTrustedSequencerURL ¶
GetTrustedSequencerURL Gets the trusted sequencer url from rollup smc
func (*Client) GetTx ¶
func (etherMan *Client) GetTx(ctx context.Context, txHash common.Hash) (*types.Transaction, bool, error)
GetTx function get ethereum tx
func (*Client) GetTxReceipt ¶
func (etherMan *Client) GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
GetTxReceipt function gets ethereum tx receipt
func (*Client) HeaderByNumber ¶
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*Client) LoadAuthFromKeyStore ¶
func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, error)
LoadAuthFromKeyStore loads an authorization from a key store file
func (*Client) SignTx ¶
func (etherMan *Client) SignTx(ctx context.Context, sender common.Address, tx *types.Transaction) (*types.Transaction, error)
SignTx tries to sign a transaction accordingly to the provided sender
func (*Client) SuggestedGasPrice ¶
SuggestedGasPrice returns the suggest nonce for the network at the moment
func (*Client) TrustedSequencer ¶
TrustedSequencer gets trusted sequencer address
type Config ¶
type Config struct { URL string `mapstructure:"URL"` PrivateKeyPath string `mapstructure:"PrivateKeyPath"` PrivateKeyPassword string `mapstructure:"PrivateKeyPassword"` MultiGasProvider bool `mapstructure:"MultiGasProvider"` Etherscan etherscan.Config }
Config represents the configuration of the etherman
type EventOrder ¶
type EventOrder string
EventOrder is the the type used to identify the events order
const ( // GlobalExitRootsOrder identifies a GlobalExitRoot event GlobalExitRootsOrder EventOrder = "GlobalExitRoots" // SequenceBatchesOrder identifies a VerifyBatch event SequenceBatchesOrder EventOrder = "SequenceBatches" // ForcedBatchesOrder identifies a ForcedBatches event ForcedBatchesOrder EventOrder = "ForcedBatches" // TrustedVerifyBatchOrder identifies a TrustedVerifyBatch event TrustedVerifyBatchOrder EventOrder = "TrustedVerifyBatch" // SequenceForceBatchesOrder identifies a SequenceForceBatches event SequenceForceBatchesOrder EventOrder = "SequenceForceBatches" // ForkIDsOrder identifies an updateZkevmVersion event ForkIDsOrder EventOrder = "forkIDs" )
type ForcedBatch ¶
type ForcedBatch struct { BlockNumber uint64 ForcedBatchNumber uint64 Sequencer common.Address GlobalExitRoot common.Hash RawTxsData []byte ForcedAt time.Time }
ForcedBatch represents a ForcedBatch
type GlobalExitRoot ¶
type GlobalExitRoot struct { BlockNumber uint64 MainnetExitRoot common.Hash RollupExitRoot common.Hash GlobalExitRoot common.Hash }
GlobalExitRoot struct
type L1Config ¶ added in v0.0.990
type L1Config struct { L1ChainID uint64 `json:"chainId"` ZkEVMAddr common.Address `json:"polygonZkEVMAddress"` MaticAddr common.Address `json:"maticTokenAddress"` GlobalExitRootManagerAddr common.Address `json:"polygonZkEVMGlobalExitRootAddress"` }
L1Config represents the configuration of the network used in L1
type Order ¶
type Order struct { Name EventOrder Pos int }
Order contains the event order to let the synchronizer store the information following this order.
type SequencedBatch ¶
type SequencedBatch struct { BatchNumber uint64 SequencerAddr common.Address TxHash common.Hash Nonce uint64 Coinbase common.Address polygonzkevm.PolygonZkEVMBatchData }
SequencedBatch represents virtual batch
type SequencedForceBatch ¶
type SequencedForceBatch struct { BatchNumber uint64 Coinbase common.Address TxHash common.Hash Timestamp time.Time Nonce uint64 polygonzkevm.PolygonZkEVMForcedBatchData }
SequencedForceBatch is a sturct to track the ForceSequencedBatches event.