Skip to content

Commit

Permalink
Cleanup proposer
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Sep 27, 2024
1 parent 8e2ed54 commit cc8b74c
Showing 1 changed file with 0 additions and 118 deletions.
118 changes: 0 additions & 118 deletions op-proposer/proposer/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,124 +255,6 @@ func (l *L2OutputSubmitter) generateNextProposal(ctx context.Context, lastPropos
return lastProposal, shouldPropose, nil
}

//// 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 (l *L2OutputSubmitter) FetchL2OOOutput(ctx context.Context) (*eth.OutputResponse, bool, error) {
// if l.l2ooContract == nil {
// return nil, false, fmt.Errorf("L2OutputOracle contract not set, cannot fetch next output info")
// }
//
// cCtx, cancel := context.WithTimeout(ctx, l.Cfg.NetworkTimeout)
// defer cancel()
// callOpts := &bind.CallOpts{
// From: l.Txmgr.From(),
// Context: cCtx,
// }
// nextCheckpointBlockBig, err := l.l2ooContract.NextBlockNumber(callOpts)
// if err != nil {
// return nil, false, fmt.Errorf("querying next block number: %w", err)
// }
// nextCheckpointBlock := nextCheckpointBlockBig.Uint64()
// // Fetch the current L2 heads
// currentBlockNumber, err := l.FetchCurrentBlockNumber(ctx)
// if err != nil {
// return nil, false, err
// }
//
// // Ensure that we do not submit a block in the future
// if currentBlockNumber < nextCheckpointBlock {
// l.Log.Debug("Proposer submission interval has not elapsed", "currentBlockNumber", currentBlockNumber, "nextBlockNumber", nextCheckpointBlock)
// return nil, false, nil
// }
//
// output, err := l.FetchOutput(ctx, nextCheckpointBlock)
// if err != nil {
// return nil, false, fmt.Errorf("fetching output: %w", err)
// }
//
// // Always propose if it's part of the Finalized L2 chain. Or if allowed, if it's part of the safe L2 chain.
// if output.BlockRef.Number > output.Status.FinalizedL2.Number && (!l.Cfg.AllowNonFinalized || output.BlockRef.Number > output.Status.SafeL2.Number) {
// l.Log.Debug("Not proposing yet, L2 block is not ready for proposal",
// "l2_proposal", output.BlockRef,
// "l2_safe", output.Status.SafeL2,
// "l2_finalized", output.Status.FinalizedL2,
// "allow_non_finalized", l.Cfg.AllowNonFinalized)
// return output, false, nil
// }
// return output, true, nil
//}
//
//// 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 (l *L2OutputSubmitter) FetchCurrentBlockNumber(ctx context.Context) (uint64, error) {
// rollupClient, err := l.RollupProvider.RollupClient(ctx)
// if err != nil {
// return 0, fmt.Errorf("getting rollup client: %w", err)
// }
//
// status, err := rollupClient.SyncStatus(ctx)
// if err != nil {
// return 0, fmt.Errorf("getting sync status: %w", err)
// }
//
// // Use either the finalized or safe head depending on the config. Finalized head is default & safer.
// if l.Cfg.AllowNonFinalized {
// return status.SafeL2.Number, nil
// }
// return status.FinalizedL2.Number, nil
//}
//
//func (l *L2OutputSubmitter) FetchOutput(ctx context.Context, block uint64) (*eth.OutputResponse, error) {
// rollupClient, err := l.RollupProvider.RollupClient(ctx)
// if err != nil {
// return nil, fmt.Errorf("getting rollup client: %w", err)
// }
//
// output, err := rollupClient.OutputAtBlock(ctx, block)
// if err != nil {
// return nil, fmt.Errorf("fetching output at block %d: %w", block, err)
// }
// if output.Version != supportedL2OutputVersion {
// return nil, fmt.Errorf("unsupported l2 output version: %v, supported: %v", output.Version, supportedL2OutputVersion)
// }
// if onum := output.BlockRef.Number; onum != block { // sanity check, e.g. in case of bad RPC caching
// return nil, fmt.Errorf("output block number %d mismatches requested %d", output.BlockRef.Number, block)
// }
// return output, nil
//}
//
//// We wait until l1head advances beyond blocknum. This is used to make sure proposal tx won't
//// immediately fail when checking the l1 blockhash. Note that EstimateGas uses "latest" state to
//// execute the transaction by default, meaning inside the call, the head block is considered
//// "pending" instead of committed. In the case l1blocknum == l1head then, blockhash(l1blocknum)
//// will produce a value of 0 within EstimateGas, and the call will fail when the contract checks
//// that l1blockhash matches blockhash(l1blocknum).
//func (l *L2OutputSubmitter) waitForL1Head(ctx context.Context, blockNum uint64) error {
// ticker := time.NewTicker(l.Cfg.PollInterval)
// defer ticker.Stop()
// l1head, err := l.Txmgr.BlockNumber(ctx)
// if err != nil {
// return err
// }
// for l1head <= blockNum {
// l.Log.Debug("Waiting for l1 head > l1blocknum1+1", "l1head", l1head, "l1blocknum", blockNum)
// select {
// case <-ticker.C:
// l1head, err = l.Txmgr.BlockNumber(ctx)
// if err != nil {
// return err
// }
// case <-l.done:
// return fmt.Errorf("L2OutputSubmitter is done()")
// }
// }
// return nil
//}
//

func (l *L2OutputSubmitter) proposeOutput(ctx context.Context, proposal *proposal) {
cCtx, cancel := context.WithTimeout(ctx, 10*time.Minute)
defer cancel()
Expand Down

0 comments on commit cc8b74c

Please sign in to comment.