challenger

package
v0.0.0-...-8dd3e70 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FaultDisputeGameType is the uint8 enum value for the fault dispute game
	FaultDisputeGameType = 0
	// ValidityDisputeGameType is the uint8 enum value for the validity dispute game
	ValidityDisputeGameType = 1
	// AttestationDisputeGameType is the uint8 enum value for the attestation dispute game
	AttestationDisputeGameType = 2
)

Variables

This section is empty.

Functions

func Main

func Main(version string, cliCtx *cli.Context) error

Main is the entrypoint into the Challenger. This executes and blocks until the service exits.

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.
	RollupRpc string

	// L2OOAddress is the L2OutputOracle contract address.
	L2OOAddress string

	// DGFAddress is the DisputeGameFactory contract address.
	DGFAddress string

	// PrivateKey is the private key of the account that will be used to send transactions.
	PrivateKey string

	TxMgrConfig flags.TxManagerCLIConfig

	LogConfig oplog.CLIConfig

	MetricsConfig opmetrics.CLIConfig

	PprofConfig oppprof.CLIConfig
}

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 challenger is started.

func NewConfig

func NewConfig(ctx *cli.Context) CLIConfig

NewConfig parses the Config from the provided flags or environment variables.

func (CLIConfig) Check

func (c CLIConfig) Check() error

type Challenger

type Challenger struct {
	// contains filtered or unexported fields
}

Challenger is responsible for disputing L2OutputOracle outputs

func NewChallenger

func NewChallenger(cfg Config, l log.Logger, m metrics.Metricer) (*Challenger, error)

NewChallenger creates a new Challenger

func NewChallengerFromCLIConfig

func NewChallengerFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metricer) (*Challenger, error)

NewChallengerFromCLIConfig creates a new Challenger given the CLI Config

func (*Challenger) Start

func (c *Challenger) Start() error

Start begins the Challenger's engine driver, adding an instance to the waitgroup.

func (*Challenger) Stop

func (c *Challenger) Stop()

Stop shuts down the Challenger.

func (*Challenger) ValidateOutput

func (c *Challenger) ValidateOutput(ctx context.Context, l2BlockNumber *big.Int, expected eth.Bytes32) (bool, *eth.Bytes32, error)

ValidateOutput checks that a given output is expected via a trusted rollup node rpc. It returns: if the output is correct, error

type Config

type Config struct {
	L2OutputOracleAddr common.Address
	DisputeGameFactory common.Address
	NetworkTimeout     time.Duration
	TxManager          txmgr.TxManager
	L1Client           *ethclient.Client
	RollupClient       *sources.RollupClient
	From               common.Address
	// contains filtered or unexported fields
}

Config contains the well typed fields that are used to initialize the challenger. It is intended for programmatic use.

func NewChallengerConfigFromCLIConfig

func NewChallengerConfigFromCLIConfig(cfg CLIConfig, l log.Logger, m metrics.Metricer) (*Config, error)

NewChallengerConfigFromCLIConfig creates the challenger config from the CLI config.

type OutputAtBlock

type OutputAtBlock struct {
	Output        common.Hash
	L2BlockNumber *big.Int
}

OutputAtBlock is the struct representation of an L2OutputOracle output at a given L2 block number.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL