Documentation ¶
Index ¶
- Variables
- func Main(version string) func(cliCtx *cli.Context) error
- func NewChannelManager(log log.Logger, channelTimeout uint64) *channelManager
- type BatchSubmitter
- type Config
- type TransactionManager
- func (t *TransactionManager) CraftTx(ctx context.Context, data []byte) (*types.Transaction, error)
- func (t *TransactionManager) SendTransaction(ctx context.Context, data []byte) (*types.Receipt, error)
- func (t *TransactionManager) UpdateGasPrice(ctx context.Context, tx *types.Transaction) (*types.Transaction, error)
Constants ¶
This section is empty.
Variables ¶
var ErrReorg = errors.New("block does not extend existing chain")
Functions ¶
func Main ¶
Main is the entrypoint into the Batch Submitter. This method returns a closure that executes the service and blocks until the service exits. The use of a closure allows the parameters bound to the top-level main package, e.g. GitVersion, to be captured and used once the function is executed.
func NewChannelManager ¶ added in v0.10.0
Types ¶
type BatchSubmitter ¶
type BatchSubmitter struct {
// contains filtered or unexported fields
}
BatchSubmitter encapsulates a service responsible for submitting L2 tx batches to L1 for availability.
func NewBatchSubmitter ¶
func NewBatchSubmitter(cfg Config, l log.Logger) (*BatchSubmitter, error)
NewBatchSubmitter initializes the BatchSubmitter, gathering any resources that will be needed during operation.
func (*BatchSubmitter) Start ¶
func (l *BatchSubmitter) Start() error
func (*BatchSubmitter) Stop ¶
func (l *BatchSubmitter) Stop()
type Config ¶
type Config struct { // L1EthRpc is the HTTP provider URL for L1. L1EthRpc string // L2EthRpc is the HTTP provider URL for the L2 execution engine. L2EthRpc string // RollupRpc is the HTTP provider URL for the L2 rollup node. RollupRpc string // MinL1TxSize is the minimum size of a batch tx submitted to L1. MinL1TxSize uint64 // MaxL1TxSize is the maximum size of a batch tx submitted to L1. MaxL1TxSize uint64 // ChannelTimeout is the maximum amount of time to attempt completing an opened channel, // as opposed to submitting missing blocks in new channels ChannelTimeout uint64 // PollInterval is the delay between querying L2 for more transaction // and creating a new batch. PollInterval time.Duration // NumConfirmations is the number of confirmations which we will wait after // appending new batches. NumConfirmations uint64 // SafeAbortNonceTooLowCount is the number of ErrNonceTooLowObservations // required to give up on a tx at a particular nonce without receiving // confirmation. SafeAbortNonceTooLowCount uint64 // ResubmissionTimeout is time we will wait before resubmitting a // transaction. ResubmissionTimeout time.Duration // Mnemonic is the HD seed used to derive the wallet private keys for both // the sequence and proposer. Must be used in conjunction with // SequencerHDPath and ProposerHDPath. Mnemonic string // SequencerHDPath is the derivation path used to obtain the private key for // batched submission of sequencer transactions. SequencerHDPath string // PrivateKey is the private key used to submit sequencer transactions. PrivateKey string // SequencerBatchInboxAddress is the address in which to send batch // transactions. SequencerBatchInboxAddress string RPCConfig oprpc.CLIConfig LogConfig oplog.CLIConfig MetricsConfig opmetrics.CLIConfig PprofConfig oppprof.CLIConfig }
type TransactionManager ¶ added in v0.9.0
type TransactionManager struct {
// contains filtered or unexported fields
}
TransactionManager wraps the simple txmgr package to make it easy to send & wait for transactions
func NewTransactionManager ¶ added in v0.10.2
func (*TransactionManager) CraftTx ¶ added in v0.9.0
func (t *TransactionManager) CraftTx(ctx context.Context, data []byte) (*types.Transaction, error)
CraftTx creates the signed transaction to the batchInboxAddress. It queries L1 for the current fee market conditions as well as for the nonce. NOTE: This method SHOULD NOT publish the resulting transaction.
func (*TransactionManager) SendTransaction ¶ added in v0.9.0
func (t *TransactionManager) SendTransaction(ctx context.Context, data []byte) (*types.Receipt, error)
SendTransaction creates & submits a transaction to the batch inbox address with the given `data`. It currently uses the underlying `txmgr` to handle transaction sending & price management. This is a blocking method. It should not be called concurrently. TODO: where to put concurrent transaction handling logic.
func (*TransactionManager) UpdateGasPrice ¶ added in v0.9.0
func (t *TransactionManager) UpdateGasPrice(ctx context.Context, tx *types.Transaction) (*types.Transaction, error)
UpdateGasPrice signs an otherwise identical txn to the one provided but with updated gas prices sampled from the existing network conditions.
NOTE: This method SHOULD NOT publish the resulting transaction.