• Matthew Slipper's avatar
    op-batcher op-proposer op-service: Introduce op-service (#3202) · 8ed8d4ec
    Matthew Slipper authored
    * op-batcher op-proposer op-service: Introduce op-service
    
    op-service is a utilities library that automates much of the boilerplate setup we've been duplicating across different daemons. This PR adds the following to op-batcher:
    
    - Common setup utilities for logging, metrics, pprof, and RPC.
    - For each of the above functions, a set of CLI flags and configs that can be used to parse + validate CLI configuration for that module.
    - A base RPC server that implementers can extend.
    - HTTP metrics utilities.
    
    * update dockerfiles
    
    * code review updates
    
    * op-service: temporary replace, until op-service go module is canonical and can be resolved
    Co-authored-by: default avatarprotolambda <proto@protolambda.com>
    8ed8d4ec
main.go 778 Bytes
package main

import (
	"fmt"
	"os"

	oplog "github.com/ethereum-optimism/optimism/op-service/log"

	"github.com/ethereum/go-ethereum/log"
	"github.com/urfave/cli"

	batcher "github.com/ethereum-optimism/optimism/op-batcher"
	"github.com/ethereum-optimism/optimism/op-batcher/flags"
)

var (
	Version   = ""
	GitCommit = ""
	GitDate   = ""
)

func main() {
	oplog.SetupDefaults()

	app := cli.NewApp()
	app.Flags = flags.Flags
	app.Version = fmt.Sprintf("%s-%s-%s", Version, GitCommit, GitDate)
	app.Name = "op-batcher"
	app.Usage = "Batch Submitter Service"
	app.Description = "Service for generating and submitting L2 tx batches " +
		"to L1"

	app.Action = batcher.Main(Version)
	err := app.Run(os.Args)
	if err != nil {
		log.Crit("Application failed", "message", err)
	}
}