Documentation ¶
Index ¶
- Constants
- Variables
- func IsOutputDeleted(outputRoot [32]byte) bool
- func Main(version string, cliCtx *cli.Context) error
- func SubmitL2OutputTxData(abi *abi.ABI, output *eth.OutputResponse) ([]byte, error)
- type CLIConfig
- type ChallengeCreatedEvent
- type Challenger
- func (c *Challenger) Bisect(ctx context.Context, outputIndex *big.Int, challenger common.Address) (*types.Transaction, error)
- func (c *Challenger) BuildSegments(ctx context.Context, turn uint8, segStart, segSize uint64) (*chal.Segments, error)
- func (c *Challenger) CancelChallenge(ctx context.Context, outputIndex *big.Int) (*types.Transaction, error)
- func (c *Challenger) ChallengerTimeout(ctx context.Context, outputIndex *big.Int, challenger common.Address) (*types.Transaction, error)
- func (c *Challenger) CreateChallenge(ctx context.Context, outputRange *OutputRange) (*types.Transaction, error)
- func (c *Challenger) GetChallenge(ctx context.Context, outputIndex *big.Int, challenger common.Address) (bindings.TypesChallenge, error)
- func (c *Challenger) GetChallengeStatus(ctx context.Context, outputIndex *big.Int, challenger common.Address) (uint8, error)
- func (c *Challenger) HasEnoughDeposit(ctx context.Context) (bool, error)
- func (c *Challenger) InitConfig(ctx context.Context) error
- func (c *Challenger) IsInChallengeCreationPeriod(ctx context.Context, outputIndex *big.Int) (bool, error)
- func (c *Challenger) IsOutputFinalized(ctx context.Context, outputIndex *big.Int) (bool, error)
- func (c *Challenger) OutputAtBlockSafe(ctx context.Context, blockNumber uint64) (*eth.OutputResponse, error)
- func (c *Challenger) OutputWithProofAtBlockSafe(ctx context.Context, blockNumber uint64) (*eth.OutputResponse, error)
- func (c *Challenger) OutputsAtIndex(ctx context.Context, outputIndex *big.Int) (*Outputs, error)
- func (c *Challenger) ProveFault(ctx context.Context, outputIndex *big.Int, challenger common.Address, ...) (*types.Transaction, error)
- func (c *Challenger) PublicInputProof(ctx context.Context, blockNumber uint64) (bindings.TypesPublicInputProof, error)
- func (c *Challenger) Start(ctx context.Context) error
- func (c *Challenger) Stop() error
- func (c *Challenger) ValidateOutput(outputIndex *big.Int, outputs *Outputs) *OutputRange
- type Config
- type Guardian
- func (g *Guardian) CheckConfirmCondition(ctx context.Context, transactionId *big.Int, outputIndex *big.Int) (bool, error)
- func (g *Guardian) ConfirmTransaction(ctx context.Context, transactionId *big.Int) (*types.Transaction, error)
- func (g *Guardian) InitConfig(ctx context.Context) error
- func (g *Guardian) OutputRootAtBlock(ctx context.Context, l2BlockNumber uint64) (eth.Bytes32, error)
- func (g *Guardian) RequestDeletion(ctx context.Context, outputIndex *big.Int) (*types.Transaction, error)
- func (g *Guardian) Start(ctx context.Context) error
- func (g *Guardian) Stop() error
- func (g *Guardian) ValidateL2Output(ctx context.Context, outputRoot eth.Bytes32, l2BlockNumber uint64) (bool, error)
- type L2OutputSubmitter
- func (l *L2OutputSubmitter) CalculateWaitTime(ctx context.Context, nextBlockNumber *big.Int) time.Duration
- func (l *L2OutputSubmitter) FetchCurrentBlockNumber(ctx context.Context) (*big.Int, error)
- func (l *L2OutputSubmitter) FetchNextBlockNumber(ctx context.Context) (*big.Int, error)
- func (l *L2OutputSubmitter) FetchOutput(ctx context.Context, blockNumber *big.Int) (*eth.OutputResponse, error)
- func (l *L2OutputSubmitter) InitConfig(ctx context.Context) error
- func (l *L2OutputSubmitter) L2ooAbi() *abi.ABI
- func (l *L2OutputSubmitter) Start(ctx context.Context) error
- func (l *L2OutputSubmitter) Stop() error
- type OutputRange
- type OutputSubmittedEvent
- type Outputs
- type ProofFetcher
- type Validator
Constants ¶
const ( KeyEventOutputSubmitted = "OutputSubmitted" KeyEventChallengeCreated = "ChallengeCreated" KeyEventReadyToProve = "ReadyToProve" )
Variables ¶
var PublicRoundAddress = common.HexToAddress(publicRoundHex)
Functions ¶
func IsOutputDeleted ¶
IsOutputDeleted checks if the output is deleted.
func Main ¶
Main is the entrypoint into the Validator. This method executes the service and blocks until the service exits.
func SubmitL2OutputTxData ¶
SubmitL2OutputTxData creates the transaction data for the submitL2OutputTx function.
Types ¶
type CLIConfig ¶
type CLIConfig struct { // L1EthRpc is the Websocket 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 rollup node. RollupRpc string // L2OOAddress is the L2OutputOracle contract address. L2OOAddress string // ColosseumAddress is the Colosseum contract address. ColosseumAddress string // SecurityCouncilAddress is the SecurityCouncil contract address. SecurityCouncilAddress string // ValPoolAddress is the ValidatorPool contract address. ValPoolAddress string // ChallengerPollInterval is how frequently to poll L2 for new finalized outputs. ChallengerPollInterval time.Duration // ProverRPC is the URL of prover jsonRPC server. ProverRPC string // AllowNonFinalized can be set to true to submit outputs // for L2 blocks derived from non-finalized L1 data. AllowNonFinalized bool OutputSubmitterEnabled bool OutputSubmitterAllowPublicRound bool // OutputSubmitterRetryInterval is how frequently to retry output submission. OutputSubmitterRetryInterval time.Duration // OutputSubmitterRoundBuffer is how many blocks before each round to start trying submission. OutputSubmitterRoundBuffer uint64 ChallengerEnabled bool GuardianEnabled bool FetchingProofTimeout time.Duration TxMgrConfig txmgr.CLIConfig RPCConfig oprpc.CLIConfig LogConfig oplog.CLIConfig MetricsConfig opmetrics.CLIConfig PprofConfig pprof.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 Validator is started.
type ChallengeCreatedEvent ¶
type ChallengeCreatedEvent struct { OutputIndex *big.Int Asserter common.Address Challenger common.Address }
func NewChallengeCreatedEvent ¶
func NewChallengeCreatedEvent(log types.Log) ChallengeCreatedEvent
type Challenger ¶
type Challenger struct {
// contains filtered or unexported fields
}
func NewChallenger ¶
func (*Challenger) Bisect ¶
func (c *Challenger) Bisect(ctx context.Context, outputIndex *big.Int, challenger common.Address) (*types.Transaction, error)
func (*Challenger) BuildSegments ¶
func (*Challenger) CancelChallenge ¶
func (c *Challenger) CancelChallenge(ctx context.Context, outputIndex *big.Int) (*types.Transaction, error)
func (*Challenger) ChallengerTimeout ¶
func (c *Challenger) ChallengerTimeout(ctx context.Context, outputIndex *big.Int, challenger common.Address) (*types.Transaction, error)
func (*Challenger) CreateChallenge ¶
func (c *Challenger) CreateChallenge(ctx context.Context, outputRange *OutputRange) (*types.Transaction, error)
func (*Challenger) GetChallenge ¶
func (c *Challenger) GetChallenge(ctx context.Context, outputIndex *big.Int, challenger common.Address) (bindings.TypesChallenge, error)
func (*Challenger) GetChallengeStatus ¶
func (*Challenger) HasEnoughDeposit ¶
func (c *Challenger) HasEnoughDeposit(ctx context.Context) (bool, error)
HasEnoughDeposit checks if challenger has enough deposit to bond when creating challenge.
func (*Challenger) InitConfig ¶
func (c *Challenger) InitConfig(ctx context.Context) error
func (*Challenger) IsInChallengeCreationPeriod ¶
func (*Challenger) IsOutputFinalized ¶
func (*Challenger) OutputAtBlockSafe ¶
func (c *Challenger) OutputAtBlockSafe(ctx context.Context, blockNumber uint64) (*eth.OutputResponse, error)
func (*Challenger) OutputWithProofAtBlockSafe ¶
func (c *Challenger) OutputWithProofAtBlockSafe(ctx context.Context, blockNumber uint64) (*eth.OutputResponse, error)
func (*Challenger) OutputsAtIndex ¶
func (*Challenger) ProveFault ¶
func (c *Challenger) ProveFault(ctx context.Context, outputIndex *big.Int, challenger common.Address, skipSelectFaultPosition bool) (*types.Transaction, error)
ProveFault creates proveFault transaction for invalid output root. TODO: ProveFault will take long time, so that we may have to handle it carefully.
func (*Challenger) PublicInputProof ¶
func (c *Challenger) PublicInputProof(ctx context.Context, blockNumber uint64) (bindings.TypesPublicInputProof, error)
func (*Challenger) Stop ¶
func (c *Challenger) Stop() error
func (*Challenger) ValidateOutput ¶
func (c *Challenger) ValidateOutput(outputIndex *big.Int, outputs *Outputs) *OutputRange
ValidateOutput validates the output for the given outputIndex.
type Config ¶
type Config struct { L2OutputOracleAddr common.Address ColosseumAddr common.Address SecurityCouncilAddr common.Address ValidatorPoolAddr common.Address ChallengerPollInterval time.Duration NetworkTimeout time.Duration TxManager *txmgr.BufferedTxManager L1Client *ethclient.Client L2Client *ethclient.Client RollupClient *sources.RollupClient RollupConfig *rollup.Config AllowNonFinalized bool OutputSubmitterEnabled bool OutputSubmitterAllowPublicRound bool OutputSubmitterRetryInterval time.Duration OutputSubmitterRoundBuffer uint64 ChallengerEnabled bool GuardianEnabled bool ProofFetcher ProofFetcher }
Config contains the well typed fields that are used to initialize the output submitter. It is intended for programmatic use.
func NewValidatorConfig ¶
NewValidatorConfig creates a validator config with given the CLIConfig
type Guardian ¶
type Guardian struct {
// contains filtered or unexported fields
}
Guardian is responsible for validating outputs.
func NewGuardian ¶
NewGuardian creates a new Guardian.
func (*Guardian) CheckConfirmCondition ¶ added in v1.3.3
func (*Guardian) ConfirmTransaction ¶
func (*Guardian) OutputRootAtBlock ¶
func (*Guardian) RequestDeletion ¶
type L2OutputSubmitter ¶
type L2OutputSubmitter struct {
// contains filtered or unexported fields
}
L2OutputSubmitter is responsible for submitting outputs.
func NewL2OutputSubmitter ¶
NewL2OutputSubmitter creates a new L2OutputSubmitter.
func (*L2OutputSubmitter) CalculateWaitTime ¶
func (l *L2OutputSubmitter) CalculateWaitTime(ctx context.Context, nextBlockNumber *big.Int) time.Duration
CalculateWaitTime checks the conditions for submitting L2Output and calculates the required latency. Returns time 0 if the conditions are such that submission is possible immediately.
func (*L2OutputSubmitter) FetchCurrentBlockNumber ¶
func (*L2OutputSubmitter) FetchNextBlockNumber ¶
func (*L2OutputSubmitter) FetchOutput ¶
func (l *L2OutputSubmitter) FetchOutput(ctx context.Context, blockNumber *big.Int) (*eth.OutputResponse, error)
FetchOutput gets the output information to the corresponding block number. It returns the output info if the output can be made, otherwise error.
func (*L2OutputSubmitter) InitConfig ¶
func (l *L2OutputSubmitter) InitConfig(ctx context.Context) error
func (*L2OutputSubmitter) L2ooAbi ¶
func (l *L2OutputSubmitter) L2ooAbi() *abi.ABI
func (*L2OutputSubmitter) Stop ¶
func (l *L2OutputSubmitter) Stop() error
type OutputRange ¶
type OutputSubmittedEvent ¶
type OutputSubmittedEvent struct { ExpectedOutputRoot string OutputIndex *big.Int L2BlockNumber *big.Int }
func NewOutputSubmittedEvent ¶
func NewOutputSubmittedEvent(log types.Log) OutputSubmittedEvent
type Outputs ¶
type Outputs struct { RemoteOutput bindings.TypesCheckpointOutput LocalOutput *eth.OutputResponse }
type ProofFetcher ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}