Skip to content
Draft
498 changes: 498 additions & 0 deletions op-proposer/bindings/anchorstateregistry.go

Large diffs are not rendered by default.

174 changes: 170 additions & 4 deletions op-proposer/bindings/disputegamefactory.go

Large diffs are not rendered by default.

2,148 changes: 2,148 additions & 0 deletions op-proposer/bindings/zkfaultdisputegame.go

Large diffs are not rendered by default.

1,528 changes: 1,528 additions & 0 deletions op-proposer/bindings/zkfaultproofconfig.go

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions op-proposer/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ var (
Usage: "Address of the DisputeGameFactory contract",
EnvVars: prefixEnvVars("GAME_FACTORY_ADDRESS"),
}
AnchorStateRegistryAddressFlag = &cli.StringFlag{
Name: "anchor-state-registry-address",
Usage: "Address of the AnchorStateRegistry contract",
EnvVars: prefixEnvVars("ANCHOR_STATE_REGISTRY_ADDRESS"),
}
ProposalIntervalFlag = &cli.DurationFlag{
Name: "proposal-interval",
Usage: "Interval between submitting L2 output proposals when the dispute game factory address is set",
Expand All @@ -66,6 +71,22 @@ var (
Value: 0,
EnvVars: prefixEnvVars("GAME_TYPE"),
}
ZKProposalBatchSizeFlag = &cli.UintFlag{
Name: "zk-proposal-batch-size",
Usage: "When the game type is zk dispute game, you can specify how many block outputRoots are submitted per batch",
Value: 3600,
EnvVars: prefixEnvVars("ZK_PROPOSAL_BATCH_SIZE"),
}
ZKProposalParentGameAddressFlag = &cli.StringFlag{
Name: "zk-proposal-parent-game-address",
Usage: "When the game type is zk dispute game, you can specify the address of the parent game to use at startup",
EnvVars: prefixEnvVars("ZK_PROPOSAL_PARENT_GAME_ADDRESS"),
}
ZKProposalLastGameCachePathFlag = &cli.StringFlag{
Name: "zk-proposal-last-game-cache-path",
Usage: "When the game type is zk dispute game, you can specify a path to cache the game information from the last submission, so that you can quickly resume from where you left off after restarting",
EnvVars: prefixEnvVars("ZK_PROPOSAL_PARENT_GAME_ADDRESS"),
}
ActiveSequencerCheckDurationFlag = &cli.DurationFlag{
Name: "active-sequencer-check-duration",
Usage: "The duration between checks to determine the active sequencer endpoint.",
Expand Down Expand Up @@ -94,10 +115,14 @@ var optionalFlags = []cli.Flag{
AllowNonFinalizedFlag,
L2OutputHDPathFlag,
DisputeGameFactoryAddressFlag,
AnchorStateRegistryAddressFlag,
ProposalIntervalFlag,
DisputeGameTypeFlag,
ActiveSequencerCheckDurationFlag,
WaitNodeSyncFlag,
ZKProposalBatchSizeFlag,
ZKProposalParentGameAddressFlag,
ZKProposalLastGameCachePathFlag,
}

func init() {
Expand Down
36 changes: 26 additions & 10 deletions op-proposer/proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type CLIConfig struct {
// DGFAddress is the DisputeGameFactory contract address.
DGFAddress string

// AnchorStateRegistryAddr is the AnchorStateRegistry contract address.
AnchorStateRegistryAddr string

// ProposalInterval is the delay between submitting L2 output proposals when the DGFAddress is set.
ProposalInterval time.Duration

Expand All @@ -61,6 +64,12 @@ type CLIConfig struct {

// Whether to wait for the sequencer to sync to a recent block at startup.
WaitNodeSync bool
// ZKProposalBatchSize is defined as the number of block heights of outputRoot submitted in a batch when the game type is zk dispute game.
ZKProposalBatchSize uint64
// ZKParentGameAddress specifies the address of the parent game to be used at startup when the game type is a zk dispute game.
ZKParentGameAddress string
// ZKProposalLastGameCachePathFlag specifies the storage path for the last game's cache
ZKProposalLastGameCachePathFlag string
}

func (c *CLIConfig) Check() error {
Expand All @@ -86,6 +95,9 @@ func (c *CLIConfig) Check() error {
if c.DGFAddress != "" && c.ProposalInterval == 0 {
return errors.New("the `DisputeGameFactory` address was provided but the `ProposalInterval` was not set")
}
if c.DGFAddress != "" && c.DisputeGameType == zkDisputeGameType && c.AnchorStateRegistryAddr == "" {
return errors.New("when setting `DisputeGameFactory` and the game type == 3, the `AnchorStateRegistry` address must be set")
}
if c.ProposalInterval != 0 && c.DGFAddress == "" {
return errors.New("the `ProposalInterval` was provided but the `DisputeGameFactory` address was not set")
}
Expand All @@ -103,15 +115,19 @@ func NewConfig(ctx *cli.Context) *CLIConfig {
PollInterval: ctx.Duration(flags.PollIntervalFlag.Name),
TxMgrConfig: txmgr.ReadCLIConfig(ctx),
// Optional Flags
AllowNonFinalized: ctx.Bool(flags.AllowNonFinalizedFlag.Name),
RPCConfig: oprpc.ReadCLIConfig(ctx),
LogConfig: oplog.ReadCLIConfig(ctx),
MetricsConfig: opmetrics.ReadCLIConfig(ctx),
PprofConfig: oppprof.ReadCLIConfig(ctx),
DGFAddress: ctx.String(flags.DisputeGameFactoryAddressFlag.Name),
ProposalInterval: ctx.Duration(flags.ProposalIntervalFlag.Name),
DisputeGameType: uint32(ctx.Uint(flags.DisputeGameTypeFlag.Name)),
ActiveSequencerCheckDuration: ctx.Duration(flags.ActiveSequencerCheckDurationFlag.Name),
WaitNodeSync: ctx.Bool(flags.WaitNodeSyncFlag.Name),
AllowNonFinalized: ctx.Bool(flags.AllowNonFinalizedFlag.Name),
RPCConfig: oprpc.ReadCLIConfig(ctx),
LogConfig: oplog.ReadCLIConfig(ctx),
MetricsConfig: opmetrics.ReadCLIConfig(ctx),
PprofConfig: oppprof.ReadCLIConfig(ctx),
DGFAddress: ctx.String(flags.DisputeGameFactoryAddressFlag.Name),
AnchorStateRegistryAddr: ctx.String(flags.AnchorStateRegistryAddressFlag.Name),
ProposalInterval: ctx.Duration(flags.ProposalIntervalFlag.Name),
DisputeGameType: uint32(ctx.Uint(flags.DisputeGameTypeFlag.Name)),
ZKProposalBatchSize: uint64(ctx.Uint(flags.ZKProposalBatchSizeFlag.Name)),
ZKParentGameAddress: ctx.String(flags.ZKProposalParentGameAddressFlag.Name),
ZKProposalLastGameCachePathFlag: ctx.String(flags.ZKProposalLastGameCachePathFlag.Name),
ActiveSequencerCheckDuration: ctx.Duration(flags.ActiveSequencerCheckDurationFlag.Name),
WaitNodeSync: ctx.Bool(flags.WaitNodeSyncFlag.Name),
}
}
Loading
Loading