-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathflags.go
More file actions
526 lines (511 loc) · 18.9 KB
/
Copy pathflags.go
File metadata and controls
526 lines (511 loc) · 18.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
package flags
import (
"fmt"
"time"
"github.com/urfave/cli/v2"
"github.com/ethereum-optimism/optimism/op-node/rollup/sync"
plasma "github.com/ethereum-optimism/optimism/op-plasma"
openum "github.com/ethereum-optimism/optimism/op-service/enum"
opflags "github.com/ethereum-optimism/optimism/op-service/flags"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/oppprof"
"github.com/ethereum-optimism/optimism/op-service/sources"
)
// Flags
const EnvVarPrefix = "OP_NODE"
const (
RollupCategory = "1. ROLLUP"
L1RPCCategory = "2. L1 RPC"
SequencerCategory = "3. SEQUENCER"
OperationsCategory = "4. LOGGING, METRICS, DEBUGGING, AND API"
P2PCategory = "5. PEER-TO-PEER"
PlasmaCategory = "6. PLASMA (EXPERIMENTAL)"
MiscCategory = "7. MISC"
)
func init() {
cli.HelpFlag.(*cli.BoolFlag).Category = MiscCategory
cli.VersionFlag.(*cli.BoolFlag).Category = MiscCategory
}
func prefixEnvVars(names ...string) []string {
envs := make([]string, 0, len(names))
for _, name := range names {
envs = append(envs, EnvVarPrefix+"_"+name)
}
return envs
}
var (
/* Required Flags */
L1NodeAddr = &cli.StringFlag{
Name: "l1",
Usage: "Address of L1 User JSON-RPC endpoint to use (eth namespace required). Multiple alternative addresses are supported, separated by commas, and the first address is used by default",
Value: "http://127.0.0.1:8545",
EnvVars: prefixEnvVars("L1_ETH_RPC"),
Category: RollupCategory,
}
L2EngineAddr = &cli.StringFlag{
Name: "l2",
Usage: "Address of L2 Engine JSON-RPC endpoints to use (engine and eth namespace required)",
EnvVars: prefixEnvVars("L2_ENGINE_RPC"),
Category: RollupCategory,
}
L2EngineJWTSecret = &cli.StringFlag{
Name: "l2.jwt-secret",
Usage: "Path to JWT secret key. Keys are 32 bytes, hex encoded in a file. A new key will be generated if the file is empty.",
EnvVars: prefixEnvVars("L2_ENGINE_AUTH"),
Value: "",
Destination: new(string),
Category: RollupCategory,
}
BeaconAddr = &cli.StringFlag{
Name: "l1.beacon",
Usage: "Address of L1 Beacon-node HTTP endpoint to use.",
Required: false,
EnvVars: prefixEnvVars("L1_BEACON"),
Category: RollupCategory,
}
/* Optional Flags */
BeaconHeader = &cli.StringFlag{
Name: "l1.beacon-header",
Usage: "Optional HTTP header to add to all requests to the L1 Beacon endpoint. Format: 'X-Key: Value'",
Required: false,
EnvVars: prefixEnvVars("L1_BEACON_HEADER"),
Category: L1RPCCategory,
}
BeaconFallbackAddrs = &cli.StringSliceFlag{
Name: "l1.beacon-fallbacks",
Aliases: []string{"l1.beacon-archiver"},
Usage: "Addresses of L1 Beacon-API compatible HTTP fallback endpoints. Used to fetch blob sidecars not availalbe at the l1.beacon (e.g. expired blobs).",
EnvVars: prefixEnvVars("L1_BEACON_FALLBACKS", "L1_BEACON_ARCHIVER"),
Category: L1RPCCategory,
}
BeaconCheckIgnore = &cli.BoolFlag{
Name: "l1.beacon.ignore",
Usage: "When false, halts op-node startup if the healthcheck to the Beacon-node endpoint fails.",
Required: false,
Value: false,
EnvVars: prefixEnvVars("L1_BEACON_IGNORE"),
Category: L1RPCCategory,
}
BeaconFetchAllSidecars = &cli.BoolFlag{
Name: "l1.beacon.fetch-all-sidecars",
Usage: "If true, all sidecars are fetched and filtered locally. Workaround for buggy Beacon nodes.",
Required: false,
Value: false,
EnvVars: prefixEnvVars("L1_BEACON_FETCH_ALL_SIDECARS"),
Category: L1RPCCategory,
}
SyncModeFlag = &cli.GenericFlag{
Name: "syncmode",
Usage: fmt.Sprintf("Blockchain sync mode (options: %s)", openum.EnumString(sync.ModeStrings)),
EnvVars: prefixEnvVars("SYNCMODE"),
Value: func() *sync.Mode {
out := sync.CLSync
return &out
}(),
Category: RollupCategory,
}
RPCListenAddr = &cli.StringFlag{
Name: "rpc.addr",
Usage: "RPC listening address",
EnvVars: prefixEnvVars("RPC_ADDR"),
Value: "127.0.0.1",
Category: OperationsCategory,
}
RPCListenPort = &cli.IntFlag{
Name: "rpc.port",
Usage: "RPC listening port",
EnvVars: prefixEnvVars("RPC_PORT"),
Value: 9545, // Note: op-service/rpc/cli.go uses 8545 as the default.
Category: OperationsCategory,
}
RPCEnableAdmin = &cli.BoolFlag{
Name: "rpc.enable-admin",
Usage: "Enable the admin API (experimental)",
EnvVars: prefixEnvVars("RPC_ENABLE_ADMIN"),
Category: OperationsCategory,
}
RPCAdminPersistence = &cli.StringFlag{
Name: "rpc.admin-state",
Usage: "File path used to persist state changes made via the admin API so they persist across restarts. Disabled if not set.",
EnvVars: prefixEnvVars("RPC_ADMIN_STATE"),
Category: OperationsCategory,
}
L1TrustRPC = &cli.BoolFlag{
Name: "l1.trustrpc",
Usage: "Trust the L1 RPC, sync faster at risk of malicious/buggy RPC providing bad or inconsistent L1 data",
EnvVars: prefixEnvVars("L1_TRUST_RPC"),
Category: L1RPCCategory,
}
L1RPCProviderKind = &cli.GenericFlag{
Name: "l1.rpckind",
Usage: "The kind of RPC provider, used to inform optimal transactions receipts fetching, and thus reduce costs. Valid options: " +
openum.EnumString(sources.RPCProviderKinds),
EnvVars: prefixEnvVars("L1_RPC_KIND"),
Value: func() *sources.RPCProviderKind {
out := sources.RPCKindStandard
return &out
}(),
Category: L1RPCCategory,
}
L1RethDBPath = &cli.StringFlag{
Name: "l1.rethdb",
Usage: "The L1 RethDB path, used to fetch receipts for L1 blocks. Only applicable when using the `reth_db` RPC kind with `l1.rpckind`.",
EnvVars: prefixEnvVars("L1_RETHDB"),
Hidden: true,
Category: L1RPCCategory,
}
L1RPCMaxConcurrency = &cli.IntFlag{
Name: "l1.max-concurrency",
Usage: "Maximum number of concurrent RPC requests to make to the L1 RPC provider.",
EnvVars: prefixEnvVars("L1_MAX_CONCURRENCY"),
Value: 10,
Category: L1RPCCategory,
}
L1RPCRateLimit = &cli.Float64Flag{
Name: "l1.rpc-rate-limit",
Usage: "Optional self-imposed global rate-limit on L1 RPC requests, specified in requests / second. Disabled if set to 0.",
EnvVars: prefixEnvVars("L1_RPC_RATE_LIMIT"),
Value: 0,
Category: L1RPCCategory,
}
L1RPCMaxBatchSize = &cli.IntFlag{
Name: "l1.rpc-max-batch-size",
Usage: "Maximum number of RPC requests to bundle, e.g. during L1 blocks receipt fetching. The L1 RPC rate limit counts this as N items, but allows it to burst at once.",
EnvVars: prefixEnvVars("L1_RPC_MAX_BATCH_SIZE"),
Value: 20,
Category: L1RPCCategory,
}
L1RPCMaxCacheSize = &cli.IntFlag{
Name: "l1.rpc-max-cache-size",
Usage: "The maximum cache size of the L1 client. it should be greater than or equal to the maximum height difference between the L1 blocks corresponding to the unsafe block height and the safe block height. Must be greater than or equal to 1",
EnvVars: prefixEnvVars("L1_RPC_MAX_CACHE_SIZE"),
Value: 1000,
Category: L1RPCCategory,
}
L1HTTPPollInterval = &cli.DurationFlag{
Name: "l1.http-poll-interval",
Usage: "Polling interval for latest-block subscription when using an HTTP RPC provider. Ignored for other types of RPC endpoints.",
EnvVars: prefixEnvVars("L1_HTTP_POLL_INTERVAL"),
Value: time.Second * 3,
Category: L1RPCCategory,
}
L1ArchiveBlobRpcAddr = &cli.StringFlag{
Name: "l1.archive-blob-rpc",
Usage: "Optional address of L1 archive blob endpoint to use. Multiple alternative addresses are supported, separated by commas, and will rotate when error",
Required: false,
EnvVars: prefixEnvVars("L1_ARCHIVE_BLOB_RPC"),
Category: RollupCategory,
}
L1BlobRpcRateLimit = &cli.Float64Flag{
Name: "l1.blob-rpc-rate-limit",
Usage: "Optional self-imposed global rate-limit on L1 blob RPC requests, specified in requests / second. Disabled if set to 0.",
EnvVars: prefixEnvVars("L1_BLOB_RPC_RATE_LIMIT"),
Value: 0,
Category: L1RPCCategory,
}
L1BlobRpcMaxBatchSize = &cli.IntFlag{
Name: "l1.blob-rpc-max-batch-size",
Usage: "Optional maximum number of L1 blob RPC requests to bundle",
EnvVars: prefixEnvVars("L1_BLOB_RPC_MAX_BATCH_SIZE"),
Value: 20,
Category: L1RPCCategory,
}
VerifierL1Confs = &cli.Uint64Flag{
Name: "verifier.l1-confs",
Usage: "Number of L1 blocks to keep distance from the L1 head before deriving L2 data from. Reorgs are supported, but may be slow to perform.",
EnvVars: prefixEnvVars("VERIFIER_L1_CONFS"),
Value: 15,
Category: L1RPCCategory,
}
L1FinalizedConfDepth = &cli.BoolFlag{
Name: "l1-finalized-confs",
Usage: "Use L1 finalized block as the latest head for opBNB sequencer and derivation. When enabled, verifier.l1-confs and sequencer.l1-confs will be ignored.",
EnvVars: prefixEnvVars("L1_FINALIZED_CONFS"),
Value: false,
Category: L1RPCCategory,
}
SequencerEnabledFlag = &cli.BoolFlag{
Name: "sequencer.enabled",
Usage: "Enable sequencing of new L2 blocks. A separate batch submitter has to be deployed to publish the data for verifiers.",
EnvVars: prefixEnvVars("SEQUENCER_ENABLED"),
Category: SequencerCategory,
}
SequencerStoppedFlag = &cli.BoolFlag{
Name: "sequencer.stopped",
Usage: "Initialize the sequencer in a stopped state. The sequencer can be started using the admin_startSequencer RPC",
EnvVars: prefixEnvVars("SEQUENCER_STOPPED"),
Category: SequencerCategory,
}
SequencerMaxSafeLagFlag = &cli.Uint64Flag{
Name: "sequencer.max-safe-lag",
Usage: "Maximum number of L2 blocks for restricting the distance between L2 safe and unsafe. Disabled if 0.",
EnvVars: prefixEnvVars("SEQUENCER_MAX_SAFE_LAG"),
Value: 0,
Category: SequencerCategory,
}
SequencerPriorityFlag = &cli.BoolFlag{
Name: "sequencer.priority",
Usage: "Enable sequencer step takes precedence over other steps.",
EnvVars: prefixEnvVars("SEQUENCER_PRIORITY"),
Category: SequencerCategory,
}
SequencerCombinedEngineFlag = &cli.BoolFlag{
Name: "sequencer.combined-engine",
Usage: "Enable sequencer select combined engine api when sealing payload.",
EnvVars: prefixEnvVars("SEQUENCER_COMBINED_ENGINE"),
Category: SequencerCategory,
}
SequencerL1Confs = &cli.Uint64Flag{
Name: "sequencer.l1-confs",
Usage: "Number of L1 blocks to keep distance from the L1 head as a sequencer for picking an L1 origin.",
EnvVars: prefixEnvVars("SEQUENCER_L1_CONFS"),
Value: 15,
Category: SequencerCategory,
}
L1EpochPollIntervalFlag = &cli.DurationFlag{
Name: "l1.epoch-poll-interval",
Usage: "Poll interval for retrieving new L1 epoch updates such as safe and finalized block changes. Disabled if 0 or negative.",
EnvVars: prefixEnvVars("L1_EPOCH_POLL_INTERVAL"),
Value: time.Second * 1,
Category: L1RPCCategory,
}
RuntimeConfigReloadIntervalFlag = &cli.DurationFlag{
Name: "l1.runtime-config-reload-interval",
Usage: "Poll interval for reloading the runtime config, useful when config events are not being picked up. Disabled if 0 or negative.",
EnvVars: prefixEnvVars("L1_RUNTIME_CONFIG_RELOAD_INTERVAL"),
Value: time.Minute * 10,
Category: L1RPCCategory,
}
MetricsEnabledFlag = &cli.BoolFlag{
Name: "metrics.enabled",
Usage: "Enable the metrics server",
EnvVars: prefixEnvVars("METRICS_ENABLED"),
Category: OperationsCategory,
}
MetricsAddrFlag = &cli.StringFlag{
Name: "metrics.addr",
Usage: "Metrics listening address",
Value: "0.0.0.0", // TODO(CLI-4159): Switch to 127.0.0.1
EnvVars: prefixEnvVars("METRICS_ADDR"),
Category: OperationsCategory,
}
MetricsPortFlag = &cli.IntFlag{
Name: "metrics.port",
Usage: "Metrics listening port",
Value: 7300,
EnvVars: prefixEnvVars("METRICS_PORT"),
Category: OperationsCategory,
}
SnapshotLog = &cli.StringFlag{
Name: "snapshotlog.file",
Usage: "Path to the snapshot log file",
EnvVars: prefixEnvVars("SNAPSHOT_LOG"),
Category: OperationsCategory,
}
HeartbeatEnabledFlag = &cli.BoolFlag{
Name: "heartbeat.enabled",
Usage: "Enables or disables heartbeating",
EnvVars: prefixEnvVars("HEARTBEAT_ENABLED"),
Category: OperationsCategory,
}
HeartbeatMonikerFlag = &cli.StringFlag{
Name: "heartbeat.moniker",
Usage: "Sets a moniker for this node",
EnvVars: prefixEnvVars("HEARTBEAT_MONIKER"),
Category: OperationsCategory,
}
HeartbeatURLFlag = &cli.StringFlag{
Name: "heartbeat.url",
Usage: "Sets the URL to heartbeat to",
EnvVars: prefixEnvVars("HEARTBEAT_URL"),
Value: "https://heartbeat.optimism.io",
Category: OperationsCategory,
}
RollupHalt = &cli.StringFlag{
Name: "rollup.halt",
Usage: "Opt-in option to halt on incompatible protocol version requirements of the given level (major/minor/patch/none), as signaled onchain in L1",
EnvVars: prefixEnvVars("ROLLUP_HALT"),
Category: RollupCategory,
}
RollupLoadProtocolVersions = &cli.BoolFlag{
Name: "rollup.load-protocol-versions",
Usage: "Load protocol versions from the superchain L1 ProtocolVersions contract (if available), and report in logs and metrics",
EnvVars: prefixEnvVars("ROLLUP_LOAD_PROTOCOL_VERSIONS"),
Category: RollupCategory,
}
SafeDBPath = &cli.StringFlag{
Name: "safedb.path",
Usage: "File path used to persist safe head update data. Disabled if not set.",
EnvVars: prefixEnvVars("SAFEDB_PATH"),
Category: OperationsCategory,
}
FastnodeMode = &cli.BoolFlag{
Name: "fastnode",
Usage: "Fastnode has a strong dependency on a specific synchronization mode during synchronization, so please set this flag when running fastnode.",
EnvVars: prefixEnvVars("FASTNODE"),
Value: false,
}
ELTriggerGap = &cli.IntFlag{
Name: "el-trigger.gap",
Usage: "gap to trigger el-sync",
Value: 86400,
EnvVars: prefixEnvVars("EL_TRIGGER_GAP"),
}
StartupDeferGossipFlag = &cli.BoolFlag{
Name: "startup.defer-gossip",
Usage: "Defers P2P gossip processing during startup until op-geth's unsafe head has caught up to " +
"the live tip via L1 derivation. This avoids the driver/alt-sync activity loop that occurs when a node " +
"restarts with a large unsafe-head gap. Default enabled for all node types (rpc / bridge / sequencer / p2p); " +
"the catch-up loop returns quickly when no gap exists, so the cost is negligible for nodes that don't need it. " +
"Set to false to opt out and restore the pre-fix startup behavior.",
EnvVars: prefixEnvVars("STARTUP_DEFER_GOSSIP"),
Value: true,
Category: RollupCategory,
}
/* Deprecated Flags */
L2EngineSyncEnabled = &cli.BoolFlag{
Name: "l2.engine-sync",
Usage: "WARNING: Deprecated. Use --syncmode=execution-layer instead",
EnvVars: prefixEnvVars("L2_ENGINE_SYNC_ENABLED"),
Value: false,
Hidden: true,
}
SkipSyncStartCheck = &cli.BoolFlag{
Name: "l2.skip-sync-start-check",
Usage: "Skip sanity check of consistency of L1 origins of the unsafe L2 blocks when determining the sync-starting point. " +
"This defers the L1-origin verification, and is recommended to use in when utilizing l2.engine-sync",
EnvVars: prefixEnvVars("L2_SKIP_SYNC_START_CHECK"),
Value: false,
Hidden: true,
}
BetaExtraNetworks = &cli.BoolFlag{
Name: "beta.extra-networks",
Usage: "Legacy flag, ignored, all superchain-registry networks are enabled by default.",
EnvVars: prefixEnvVars("BETA_EXTRA_NETWORKS"),
Hidden: true, // hidden, this is deprecated, the flag is not used anymore.
}
BackupL2UnsafeSyncRPC = &cli.StringFlag{
Name: "l2.backup-unsafe-sync-rpc",
Usage: "Set the backup L2 unsafe sync RPC endpoint.",
EnvVars: prefixEnvVars("L2_BACKUP_UNSAFE_SYNC_RPC"),
Hidden: true,
}
BackupL2UnsafeSyncRPCTrustRPC = &cli.StringFlag{
Name: "l2.backup-unsafe-sync-rpc.trustrpc",
Usage: "Like l1.trustrpc, configure if response data from the RPC needs to be verified, e.g. blockhash computation." +
"This does not include checks if the blockhash is part of the canonical chain.",
EnvVars: prefixEnvVars("L2_BACKUP_UNSAFE_SYNC_RPC_TRUST_RPC"),
Hidden: true,
}
ConductorEnabledFlag = &cli.BoolFlag{
Name: "conductor.enabled",
Usage: "Enable the conductor service",
EnvVars: prefixEnvVars("CONDUCTOR_ENABLED"),
Value: false,
Category: SequencerCategory,
}
ConductorRpcFlag = &cli.StringFlag{
Name: "conductor.rpc",
Usage: "Conductor service rpc endpoint",
EnvVars: prefixEnvVars("CONDUCTOR_RPC"),
Value: "http://127.0.0.1:8547",
Category: SequencerCategory,
}
ConductorRpcTimeoutFlag = &cli.DurationFlag{
Name: "conductor.rpc-timeout",
Usage: "Conductor service rpc timeout",
EnvVars: prefixEnvVars("CONDUCTOR_RPC_TIMEOUT"),
Value: time.Second * 1,
Category: SequencerCategory,
}
IsP2PNodeFlag = &cli.BoolFlag{
Name: "l2.p2p-node",
Usage: "active the op-geth a P2P node.",
EnvVars: prefixEnvVars("L2_P2P_NODE"),
Value: false,
Category: OperationsCategory,
}
)
var requiredFlags = []cli.Flag{
L1NodeAddr,
L2EngineAddr,
L2EngineJWTSecret,
}
var optionalFlags = []cli.Flag{
BeaconAddr,
BeaconHeader,
BeaconFallbackAddrs,
BeaconCheckIgnore,
BeaconFetchAllSidecars,
SyncModeFlag,
FastnodeMode,
ELTriggerGap,
StartupDeferGossipFlag,
RPCListenAddr,
RPCListenPort,
L1TrustRPC,
L1RPCProviderKind,
L1RPCRateLimit,
L1RPCMaxBatchSize,
L1RPCMaxCacheSize,
L1RPCMaxConcurrency,
L1HTTPPollInterval,
L1ArchiveBlobRpcAddr,
L1BlobRpcRateLimit,
L1BlobRpcMaxBatchSize,
VerifierL1Confs,
L1FinalizedConfDepth,
IsP2PNodeFlag,
SequencerEnabledFlag,
SequencerStoppedFlag,
SequencerMaxSafeLagFlag,
SequencerPriorityFlag,
SequencerCombinedEngineFlag,
SequencerL1Confs,
L1EpochPollIntervalFlag,
RuntimeConfigReloadIntervalFlag,
RPCEnableAdmin,
RPCAdminPersistence,
MetricsEnabledFlag,
MetricsAddrFlag,
MetricsPortFlag,
SnapshotLog,
HeartbeatEnabledFlag,
HeartbeatMonikerFlag,
HeartbeatURLFlag,
RollupHalt,
RollupLoadProtocolVersions,
L1RethDBPath,
ConductorEnabledFlag,
ConductorRpcFlag,
ConductorRpcTimeoutFlag,
SafeDBPath,
}
var DeprecatedFlags = []cli.Flag{
L2EngineSyncEnabled,
SkipSyncStartCheck,
BetaExtraNetworks,
BackupL2UnsafeSyncRPC,
BackupL2UnsafeSyncRPCTrustRPC,
// Deprecated P2P Flags are added at the init step
}
// Flags contains the list of configuration options available to the binary.
var Flags []cli.Flag
func init() {
DeprecatedFlags = append(DeprecatedFlags, deprecatedP2PFlags(EnvVarPrefix)...)
optionalFlags = append(optionalFlags, P2PFlags(EnvVarPrefix)...)
optionalFlags = append(optionalFlags, oplog.CLIFlagsWithCategory(EnvVarPrefix, OperationsCategory)...)
optionalFlags = append(optionalFlags, oppprof.CLIFlagsWithCategory(EnvVarPrefix, OperationsCategory)...)
optionalFlags = append(optionalFlags, DeprecatedFlags...)
optionalFlags = append(optionalFlags, opflags.CLIFlags(EnvVarPrefix, RollupCategory)...)
optionalFlags = append(optionalFlags, plasma.CLIFlags(EnvVarPrefix, PlasmaCategory)...)
Flags = append(requiredFlags, optionalFlags...)
}
func CheckRequired(ctx *cli.Context) error {
for _, f := range requiredFlags {
if !ctx.IsSet(f.Names()[0]) {
return fmt.Errorf("flag %s is required", f.Names()[0])
}
}
return opflags.CheckRequiredXor(ctx)
}