Documentation ¶
Index ¶
- Variables
- func Main(version string) cliapp.LifecycleAction
- type CLIConfig
- type DGFContract
- type DriverSetup
- type L1Client
- type L2OOContract
- type L2OutputSubmitter
- func (l *L2OutputSubmitter) FetchCurrentBlockNumber(ctx context.Context) (uint64, error)
- func (l *L2OutputSubmitter) FetchDGFOutput(ctx context.Context) (*eth.OutputResponse, bool, error)
- func (l *L2OutputSubmitter) FetchL2OOOutput(ctx context.Context) (*eth.OutputResponse, bool, error)
- func (l *L2OutputSubmitter) FetchOutput(ctx context.Context, block uint64) (*eth.OutputResponse, error)
- func (l *L2OutputSubmitter) ProposeL2OutputDGFTxCandidate(ctx context.Context, output *eth.OutputResponse) (txmgr.TxCandidate, error)
- func (l *L2OutputSubmitter) ProposeL2OutputTxData(output *eth.OutputResponse) ([]byte, error)
- func (l *L2OutputSubmitter) StartL2OutputSubmitting() error
- func (l *L2OutputSubmitter) StopL2OutputSubmitting() error
- func (l *L2OutputSubmitter) StopL2OutputSubmittingIfRunning() error
- type ProposerConfig
- type ProposerService
- type RollupClient
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyStopped = errors.New("already stopped")
var (
ErrProposerNotRunning = errors.New("proposer is not running")
)
Functions ¶
func Main ¶
func Main(version string) cliapp.LifecycleAction
Main is the entrypoint into the L2OutputSubmitter. This method returns a cliapp.LifecycleAction, to create an op-service CLI-lifecycle-managed L2Output-submitter
Types ¶
type CLIConfig ¶
type CLIConfig struct { // L1EthRpc is the HTTP provider URL for L1. L1EthRpc string // RollupRpc is the HTTP provider URL for the rollup node. A comma-separated list enables the active rollup provider. RollupRpc string // L2OOAddress is the L2OutputOracle contract address. L2OOAddress string // PollInterval is the delay between querying L2 for more transaction // and creating a new batch. PollInterval time.Duration // AllowNonFinalized can be set to true to propose outputs // for L2 blocks derived from non-finalized L1 data. AllowNonFinalized bool TxMgrConfig txmgr.CLIConfig RPCConfig oprpc.CLIConfig LogConfig oplog.CLIConfig MetricsConfig opmetrics.CLIConfig PprofConfig oppprof.CLIConfig // DGFAddress is the DisputeGameFactory contract address. DGFAddress string // ProposalInterval is the delay between submitting L2 output proposals when the DGFAddress is set. ProposalInterval time.Duration // DisputeGameType is the type of dispute game to create when submitting an output proposal. DisputeGameType uint32 // ActiveSequencerCheckDuration is the duration between checks to determine the active sequencer endpoint. ActiveSequencerCheckDuration time.Duration // Whether to wait for the sequencer to sync to a recent block at startup. WaitNodeSync bool }
CLIConfig is a well typed config that is parsed from the CLI params. This also contains config options for auxiliary services. It is transformed into a `Config` before the L2 output submitter is started.
type DGFContract ¶ added in v1.9.1
type DGFContract interface { Version(ctx context.Context) (string, error) HasProposedSince(ctx context.Context, proposer common.Address, cutoff time.Time, gameType uint32) (bool, time.Time, error) ProposalTx(ctx context.Context, gameType uint32, outputRoot common.Hash, l2BlockNum uint64) (txmgr.TxCandidate, error) }
type DriverSetup ¶ added in v1.4.2
type DriverSetup struct { Log log.Logger Metr metrics.Metricer Cfg ProposerConfig Txmgr txmgr.TxManager L1Client L1Client Multicaller *batching.MultiCaller // RollupProvider's RollupClient() is used to retrieve output roots from RollupProvider dial.RollupProvider }
type L1Client ¶ added in v1.4.2
type L1Client interface { HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) // CodeAt returns the code of the given account. This is needed to differentiate // between contract internal errors and the local chain being out of sync. CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) // CallContract executes an Ethereum contract call with the specified data as the // input. CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) }
type L2OOContract ¶ added in v1.9.0
type L2OutputSubmitter ¶
type L2OutputSubmitter struct { DriverSetup // contains filtered or unexported fields }
L2OutputSubmitter is responsible for proposing outputs
func NewL2OutputSubmitter ¶
func NewL2OutputSubmitter(setup DriverSetup) (_ *L2OutputSubmitter, err error)
NewL2OutputSubmitter creates a new L2 Output Submitter
func (*L2OutputSubmitter) FetchCurrentBlockNumber ¶ added in v1.4.3
func (l *L2OutputSubmitter) FetchCurrentBlockNumber(ctx context.Context) (uint64, error)
FetchCurrentBlockNumber gets the current block number from the L2OutputSubmitter's RollupClient. If the `AllowNonFinalized` configuration option is set, it will return the safe head block number, and if not, it will return the finalized head block number.
func (*L2OutputSubmitter) FetchDGFOutput ¶ added in v1.9.0
func (l *L2OutputSubmitter) FetchDGFOutput(ctx context.Context) (*eth.OutputResponse, bool, error)
FetchDGFOutput queries the DGF for the latest game and infers whether it is time to make another proposal If necessary, it gets the next output proposal for the DGF, and returns it along with a boolean for whether the proposal should be submitted at all. The passed context is expected to be a lifecycle context. A network timeout context will be derived from it.
func (*L2OutputSubmitter) FetchL2OOOutput ¶ added in v1.9.0
func (l *L2OutputSubmitter) FetchL2OOOutput(ctx context.Context) (*eth.OutputResponse, bool, error)
FetchL2OOOutput gets the next output proposal for the L2OO. It queries the L2OO for the earliest next block number that should be proposed. It returns the output to propose, and whether the proposal should be submitted at all. The passed context is expected to be a lifecycle context. A network timeout context will be derived from it.
func (*L2OutputSubmitter) FetchOutput ¶ added in v1.6.1
func (l *L2OutputSubmitter) FetchOutput(ctx context.Context, block uint64) (*eth.OutputResponse, error)
func (*L2OutputSubmitter) ProposeL2OutputDGFTxCandidate ¶ added in v1.9.1
func (l *L2OutputSubmitter) ProposeL2OutputDGFTxCandidate(ctx context.Context, output *eth.OutputResponse) (txmgr.TxCandidate, error)
func (*L2OutputSubmitter) ProposeL2OutputTxData ¶
func (l *L2OutputSubmitter) ProposeL2OutputTxData(output *eth.OutputResponse) ([]byte, error)
ProposeL2OutputTxData creates the transaction data for the ProposeL2Output function
func (*L2OutputSubmitter) StartL2OutputSubmitting ¶ added in v1.4.2
func (l *L2OutputSubmitter) StartL2OutputSubmitting() error
func (*L2OutputSubmitter) StopL2OutputSubmitting ¶ added in v1.4.2
func (l *L2OutputSubmitter) StopL2OutputSubmitting() error
func (*L2OutputSubmitter) StopL2OutputSubmittingIfRunning ¶ added in v1.4.2
func (l *L2OutputSubmitter) StopL2OutputSubmittingIfRunning() error
type ProposerConfig ¶ added in v1.4.2
type ProposerConfig struct { // How frequently to poll L2 for new finalized outputs PollInterval time.Duration NetworkTimeout time.Duration // How frequently to post L2 outputs when the DisputeGameFactory is configured ProposalInterval time.Duration L2OutputOracleAddr *common.Address DisputeGameFactoryAddr *common.Address DisputeGameType uint32 // AllowNonFinalized enables the proposal of safe, but non-finalized L2 blocks. // The L1 block-hash embedded in the proposal TX is checked and should ensure the proposal // is never valid on an alternative L1 chain that would produce different L2 data. // This option is not necessary when higher proposal latency is acceptable and L1 is healthy. AllowNonFinalized bool WaitNodeSync bool }
type ProposerService ¶ added in v1.4.2
type ProposerService struct { Log log.Logger Metrics metrics.Metricer ProposerConfig TxManager txmgr.TxManager L1Client *ethclient.Client RollupProvider dial.RollupProvider Version string // contains filtered or unexported fields }
func ProposerServiceFromCLIConfig ¶ added in v1.4.2
func ProposerServiceFromCLIConfig(ctx context.Context, version string, cfg *CLIConfig, log log.Logger) (*ProposerService, error)
ProposerServiceFromCLIConfig creates a new ProposerService from a CLIConfig. The service components are fully started, except for the driver, which will not be submitting state (if it was configured to) until the Start part of the lifecycle.
func (*ProposerService) Driver ¶ added in v1.4.2
func (ps *ProposerService) Driver() rpc.ProposerDriver
Driver returns the handler on the L2Output-submitter driver element, to start/stop/restart the L2Output-submission work, for use in testing.
func (*ProposerService) Kill ¶ added in v1.4.2
func (ps *ProposerService) Kill() error
Kill is a convenience method to forcefully, non-gracefully, stop the ProposerService.
func (*ProposerService) Start ¶ added in v1.4.2
func (ps *ProposerService) Start(_ context.Context) error
Start runs once upon start of the proposer lifecycle, and starts L2Output-submission work if the proposer is configured to start submit data on startup.
func (*ProposerService) Stop ¶ added in v1.4.2
func (ps *ProposerService) Stop(ctx context.Context) error
Stop fully stops the L2Output-submitter and all its resources gracefully. After stopping, it cannot be restarted. See driver.StopL2OutputSubmitting to temporarily stop the L2Output submitter.
func (*ProposerService) Stopped ¶ added in v1.4.2
func (ps *ProposerService) Stopped() bool