-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathflags.go
More file actions
2342 lines (2197 loc) · 81.4 KB
/
flags.go
File metadata and controls
2342 lines (2197 loc) · 81.4 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
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2015 The go-ethereum Authors
// (original work)
// Copyright 2024 The Erigon Authors
// (modifications)
// This file is part of Erigon.
//
// Erigon is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Erigon is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Erigon. If not, see <http://www.gnu.org/licenses/>.
// Package utils contains internal helper functions for go-ethereum commands.
package utils
import (
"crypto/ecdsa"
"fmt"
"math/big"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
g "github.com/anacrolix/generics"
"github.com/anacrolix/missinggo/v2/panicif"
"github.com/c2h5oh/datasize"
"github.com/holiman/uint256"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/urfave/cli/v2"
"golang.org/x/time/rate"
"github.com/erigontech/erigon/cl/clparams"
"github.com/erigontech/erigon/cl/clparams/devgenesis"
"github.com/erigontech/erigon/cmd/downloader/downloadernat"
"github.com/erigontech/erigon/cmd/utils/flags"
"github.com/erigontech/erigon/common"
libkzg "github.com/erigontech/erigon/common/crypto/kzg"
"github.com/erigontech/erigon/common/dbg"
"github.com/erigontech/erigon/common/log/v3"
"github.com/erigontech/erigon/db/config3"
"github.com/erigontech/erigon/db/datadir"
"github.com/erigontech/erigon/db/downloader/downloadercfg"
"github.com/erigontech/erigon/db/snapcfg"
"github.com/erigontech/erigon/db/version"
"github.com/erigontech/erigon/diagnostics/metrics"
"github.com/erigontech/erigon/execution/builder/buildercfg"
"github.com/erigontech/erigon/execution/chain/networkname"
chainspec "github.com/erigontech/erigon/execution/chain/spec"
"github.com/erigontech/erigon/execution/protocol/params"
"github.com/erigontech/erigon/execution/protocol/rules/ethash/ethashcfg"
"github.com/erigontech/erigon/execution/state/genesiswrite"
"github.com/erigontech/erigon/execution/types"
"github.com/erigontech/erigon/node/direct"
"github.com/erigontech/erigon/node/ethconfig"
"github.com/erigontech/erigon/node/logging"
"github.com/erigontech/erigon/node/nodecfg"
"github.com/erigontech/erigon/node/paths"
"github.com/erigontech/erigon/p2p"
"github.com/erigontech/erigon/p2p/enode"
"github.com/erigontech/erigon/p2p/nat"
"github.com/erigontech/erigon/p2p/netutil"
"github.com/erigontech/erigon/polygon/heimdall"
"github.com/erigontech/erigon/rpc/gasprice/gaspricecfg"
"github.com/erigontech/erigon/rpc/rpccfg"
"github.com/erigontech/erigon/txnprovider/shutter/shuttercfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
_ "github.com/erigontech/erigon/polygon/chain" // Register Polygon chains
)
// These are all the command line flags we support.
// If you add to this list, please remember to include the
// flag in the appropriate command definition.
//
// The flags are defined here so their names and help texts
// are the same for all commands.
var (
// General settings
DataDirFlag = flags.DirectoryFlag{
Name: "datadir",
Usage: "Data directory for the databases",
Value: flags.DirectoryString(paths.DefaultDataDir()),
}
NetworkIdFlag = cli.Uint64Flag{
Name: "networkid",
Usage: "Explicitly set network id (integer)(For testnets: use --chain <testnet_name> instead)",
Value: ethconfig.Defaults.NetworkID,
}
PersistReceiptsV2Flag = cli.BoolFlag{
Name: "persist.receipts",
Aliases: []string{"experiment.persist.receipts.v2"},
Usage: "Download historical Receipts. If disabled: using state-history to re-exec transactions and generate Receipts - all RPC: eth_getLogs, eth_getBlockReceipts will work (just higher latency)",
Value: ethconfig.Defaults.PersistReceiptsCacheV2,
}
DevValidatorSeedFlag = cli.StringFlag{
Name: "dev-validator-seed",
Usage: "Deterministic BLS key seed for embedded dev validator (enables PoS dev mode)",
Value: "devnet",
}
DevValidatorCountFlag = cli.IntFlag{
Name: "dev-validator-count",
Usage: "Number of validators for PoS dev mode",
Value: 64,
}
DevSlotTimeFlag = cli.IntFlag{
Name: "dev.slot-time",
Usage: "Slot duration in seconds for PoS dev mode (minimum: 2)",
Value: 6,
}
ChainFlag = cli.StringFlag{
Name: "chain",
Usage: "name of the network to join",
// Can we remove this default? It can be destructive.
// Giulio here after it broke CI: no, we cannot remove it.
Value: networkname.Mainnet,
}
IdentityFlag = cli.StringFlag{
Name: "identity",
Usage: "Custom node name",
}
WhitelistFlag = cli.StringFlag{
Name: "whitelist",
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
}
OverrideOsakaFlag = cli.Uint64Flag{
Name: "override.osaka",
Usage: "Manually specify the Osaka fork time, overriding the bundled setting",
}
OverrideAmsterdamFlag = cli.Uint64Flag{
Name: "override.amsterdam",
Usage: "Manually specify the Amsterdam fork time, overriding the bundled setting",
}
KeepStoredChainConfigFlag = cli.BoolFlag{
Name: "keep.stored.chain.config",
Usage: "Avoid overriding chain config already stored in the DB",
}
TrustedSetupFile = cli.StringFlag{
Name: "trusted-setup-file",
Usage: "Absolute path to trusted_setup.json file",
}
// Ethash settings
EthashCachesInMemoryFlag = cli.IntFlag{
Name: "ethash.cachesinmem",
Usage: "Number of recent ethash caches to keep in memory (16MB each)",
Value: ethconfig.Defaults.Ethash.CachesInMem,
}
EthashCachesLockMmapFlag = cli.BoolFlag{
Name: "ethash.cacheslockmmap",
Usage: "Lock memory maps of recent ethash caches",
}
EthashDatasetDirFlag = flags.DirectoryFlag{
Name: "ethash.dagdir",
Usage: "Directory to store the ethash mining DAGs",
Value: flags.DirectoryString(ethconfig.Defaults.Ethash.DatasetDir),
}
EthashDatasetsLockMmapFlag = cli.BoolFlag{
Name: "ethash.dagslockmmap",
Usage: "Lock memory maps for recent ethash mining DAGs",
}
ExternalConsensusFlag = cli.BoolFlag{
Name: "externalcl",
Usage: "Enables the external consensus layer",
}
// Transaction pool settings
TxPoolDisableFlag = cli.BoolFlag{
Name: "txpool.disable",
Usage: "External pool and block producer, see ./cmd/txpool/readme.md for more info. Disabling internal txpool and block producer.",
Value: false,
}
TxPoolGossipDisableFlag = cli.BoolFlag{
Name: "txpool.gossip.disable",
Usage: "Disabling p2p gossip of txs. Any txs received by p2p - will be dropped. Some networks like 'Optimism execution engine'/'Optimistic Rollup' - using it to protect against MEV attacks",
Value: txpoolcfg.DefaultConfig.NoGossip,
}
TxPoolPriceLimitFlag = cli.Uint64Flag{
Name: "txpool.pricelimit",
Usage: "Minimum gas price (fee cap) limit to enforce for acceptance into the pool",
Value: txpoolcfg.DefaultConfig.MinFeeCap,
}
TxPoolPriceBumpFlag = cli.Uint64Flag{
Name: "txpool.pricebump",
Usage: "Price bump percentage to replace an already existing transaction",
Value: txpoolcfg.DefaultConfig.PriceBump,
}
TxPoolBlobPriceBumpFlag = cli.Uint64Flag{
Name: "txpool.blobpricebump",
Usage: "Price bump percentage to replace existing (type-3) blob transaction",
Value: txpoolcfg.DefaultConfig.BlobPriceBump,
}
TxPoolAccountSlotsFlag = cli.Uint64Flag{
Name: "txpool.accountslots",
Usage: "Minimum number of executable transaction slots guaranteed per account",
Value: txpoolcfg.DefaultConfig.AccountSlots,
}
TxPoolBlobSlotsFlag = cli.Uint64Flag{
Name: "txpool.blobslots",
Usage: "Max allowed total number of blobs (within type-3 txs) per account",
Value: txpoolcfg.DefaultConfig.BlobSlots,
}
TxPoolTotalBlobPoolLimit = cli.Uint64Flag{
Name: "txpool.totalblobpoollimit",
Usage: "Total limit of number of all blobs in txs within the txpool",
Value: txpoolcfg.DefaultConfig.TotalBlobPoolLimit,
}
TxPoolGlobalSlotsFlag = cli.IntFlag{
Name: "txpool.globalslots",
Usage: "Maximum number of executable transaction slots for all accounts",
Value: txpoolcfg.DefaultConfig.PendingSubPoolLimit,
}
TxPoolGlobalBaseFeeSlotsFlag = cli.IntFlag{
Name: "txpool.globalbasefeeslots",
Usage: "Maximum number of non-executable transactions where only not enough baseFee",
Value: txpoolcfg.DefaultConfig.BaseFeeSubPoolLimit,
}
TxPoolGlobalQueueFlag = cli.IntFlag{
Name: "txpool.globalqueue",
Usage: "Maximum number of non-executable transaction slots for all accounts",
Value: txpoolcfg.DefaultConfig.QueuedSubPoolLimit,
}
TxPoolTraceSendersFlag = cli.StringFlag{
Name: "txpool.trace.senders",
Usage: "Comma separated list of addresses, whose transactions will traced in transaction pool with debug printing",
Value: "",
}
TxPoolCommitEveryFlag = cli.DurationFlag{
Name: "txpool.commit.every",
Usage: "How often transactions should be committed to the storage",
Value: txpoolcfg.DefaultConfig.CommitEvery,
}
TxPoolQueuedDormancyFlag = cli.DurationFlag{
Name: "txpool.queued.dormancy",
Usage: "Evict queued transactions from senders with no on-chain state changes for this duration (e.g. 3h, 2h30m; 0 to disable)",
Value: txpoolcfg.DefaultConfig.QueuedDormancyDuration,
}
// Block builder/proposer settings
ProposingDisableFlag = cli.BoolFlag{
Name: "proposer.disable",
Usage: "Disables PoS proposer",
}
MinerGasLimitFlag = cli.Uint64Flag{
Name: "miner.gaslimit",
Usage: "Target gas limit for mined blocks",
}
MinerEtherbaseFlag = cli.StringFlag{
Name: "miner.etherbase",
Usage: "Public address for block mining rewards",
Value: "0",
}
MinerExtraDataFlag = cli.StringFlag{
Name: "miner.extradata",
Usage: "Block extra data set by the miner (default = client version)",
}
BuilderMaxBlobsFlag = cli.Uint64Flag{
Name: "builder.maxblobs",
Usage: "Cap the number of blob transactions included in a built block",
}
VMEnableDebugFlag = cli.BoolFlag{
Name: "vmdebug",
Usage: "Record information useful for VM and contract debugging",
}
InsecureUnlockAllowedFlag = cli.BoolFlag{
Name: "allow-insecure-unlock",
Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http",
}
RPCGlobalGasCapFlag = cli.Uint64Flag{
Name: "rpc.gascap",
Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)",
Value: ethconfig.Defaults.RPCGasCap,
}
RPCGlobalTxFeeCapFlag = cli.Float64Flag{
Name: "rpc.txfeecap",
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
Value: ethconfig.Defaults.RPCTxFeeCap,
}
// Logging and debug settings
EthStatsURLFlag = cli.StringFlag{
Name: "ethstats",
Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
Value: "",
}
FakePoWFlag = cli.BoolFlag{
Name: "fakepow",
Usage: "Disables proof-of-work verification",
}
// RPC settings
IPCDisabledFlag = cli.BoolFlag{
Name: "ipcdisable",
Usage: "Disable the IPC-RPC server",
}
IPCPathFlag = flags.DirectoryFlag{
Name: "ipcpath",
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
}
GraphQLEnabledFlag = cli.BoolFlag{
Name: "graphql",
Usage: "Enable the graphql endpoint",
Value: nodecfg.DefaultConfig.GraphQLEnabled,
}
HTTPEnabledFlag = cli.BoolFlag{
Name: "http",
Usage: "JSON-RPC server (enabled by default). Use --http=false to disable it",
Value: true,
}
HTTPServerEnabledFlag = cli.BoolFlag{
Name: "http.enabled",
Usage: "JSON-RPC HTTP server (enabled by default). Use --http.enabled=false to disable it",
Value: true,
}
HTTPListenAddrFlag = cli.StringFlag{
Name: "http.addr",
Usage: "HTTP-RPC server listening interface",
Value: nodecfg.DefaultHTTPHost,
}
HTTPPortFlag = cli.IntFlag{
Name: "http.port",
Usage: "HTTP-RPC server listening port",
Value: nodecfg.DefaultHTTPPort,
}
AuthRpcAddr = cli.StringFlag{
Name: "authrpc.addr",
Usage: "HTTP-RPC server listening interface for the Engine API",
Value: nodecfg.DefaultHTTPHost,
}
AuthRpcPort = cli.UintFlag{
Name: "authrpc.port",
Usage: "HTTP-RPC server listening port for the Engine API",
Value: nodecfg.DefaultAuthRpcPort,
}
JWTSecretPath = cli.StringFlag{
Name: "authrpc.jwtsecret",
Usage: "Path to the token that ensures safe connection between CL and EL",
Value: "",
}
HttpCompressionFlag = cli.BoolFlag{
Name: "http.compression",
Usage: "Enable compression over HTTP-RPC. Use --http.compression=false to disable it",
Value: true,
}
WsCompressionFlag = cli.BoolFlag{
Name: "ws.compression",
Usage: "Enable compression over WebSocket (enabled by default in case WS-RPC is enabled). Use --ws.enabled=false to disable it",
Value: true,
}
HTTPCORSDomainFlag = cli.StringFlag{
Name: "http.corsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
Value: "",
}
HTTPVirtualHostsFlag = cli.StringFlag{
Name: "http.vhosts",
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts 'any' or '*' as wildcard.",
Value: strings.Join(nodecfg.DefaultConfig.HTTPVirtualHosts, ","),
}
AuthRpcVirtualHostsFlag = cli.StringFlag{
Name: "authrpc.vhosts",
Usage: "Comma separated list of virtual hostnames from which to accept Engine API requests (server enforced). Accepts 'any' or '*' as wildcard.",
Value: strings.Join(nodecfg.DefaultConfig.HTTPVirtualHosts, ","),
}
HTTPApiFlag = cli.StringFlag{
Name: "http.api",
Usage: "API's offered over the HTTP-RPC interface",
Value: "eth,erigon,engine",
}
RpcBatchConcurrencyFlag = cli.UintFlag{
Name: "rpc.batch.concurrency",
Usage: "Does limit amount of goroutines to process 1 batch request. Means 1 batch request can't overload server. 1 batch still can have unlimited amount of request",
Value: 2,
}
RpcStreamingDisableFlag = cli.BoolFlag{
Name: "rpc.streaming.disable",
Usage: "Erigon has enabled json streaming for some heavy endpoints (like trace_*). It's a trade-off: greatly reduce amount of RAM (in some cases from 30GB to 30mb), but it produce invalid json format if error happened in the middle of streaming (because json is not streaming-friendly format)",
}
RpcBatchLimit = cli.IntFlag{
Name: "rpc.batch.limit",
Usage: "Maximum number of requests in a batch",
Value: 100,
}
RpcReturnDataLimit = cli.IntFlag{
Name: "rpc.returndata.limit",
Usage: "Maximum number of bytes returned from eth_call or similar invocations",
Value: 100_000,
}
HTTPTraceFlag = cli.BoolFlag{
Name: "http.trace",
Usage: "Print all HTTP requests to logs with INFO level",
}
HTTPDebugSingleFlag = cli.BoolFlag{
Name: "http.dbg.single",
Aliases: []string{"rpc.dbg.single"},
Usage: "Allow pass HTTP header 'dbg: true' to print more detailed logs - how this request was executed",
}
DBReadConcurrencyFlag = cli.IntFlag{
Name: "db.read.concurrency",
Usage: "Does limit amount of parallel db reads. Default: equal to GOMAXPROCS (or number of CPU)",
Value: min(max(10, runtime.GOMAXPROCS(-1)*64), 9_000),
}
RpcMaxConcurrentRequestsFlag = cli.IntFlag{
Name: "rpc.max.concurrency",
Usage: "Maximum number of concurrent HTTP RPC requests (HTTP admission control). 0 = use db.read.concurrency, -1 = unlimited (no admission control)",
Value: 0,
}
WsMaxConnectionsFlag = cli.IntFlag{
Name: "ws.max.connections",
Usage: "Maximum number of concurrent WebSocket connections. 0 = unlimited",
Value: 0,
}
RpcAccessListFlag = cli.StringFlag{
Name: "rpc.accessList",
Usage: "Specify granular (method-by-method) API allowlist",
}
RpcGasCapFlag = cli.UintFlag{
Name: "rpc.gascap",
Usage: "Sets a cap on gas that can be used in eth_call/estimateGas",
Value: 50000000,
}
RpcBlockRangeLimit = cli.IntFlag{
Name: "rpc.blockrange.limit",
Usage: "Maximum block range (end - begin) allowed for range queries (0 = unlimited)",
Value: 1_000,
}
RpcGetLogsMaxResults = cli.IntFlag{
Name: "rpc.logs.maxresults",
Usage: "Maximum number of logs returned by eth_getLogs, erigon_getLogs, erigon_getLatestLogs (0 = unlimited)",
Value: 20_000,
}
RpcTraceCompatFlag = cli.BoolFlag{
Name: "trace.compat",
Usage: "Bug for bug compatibility with OE for trace_ routines",
}
RpcGethCompatFlag = cli.BoolFlag{
Name: "rpc.gethcompat",
Usage: "Enables Geth-compatible storage iteration order for debug_storageRangeAt (sorted by keccak256 hash). Disabled by default for performance.",
}
RpcTxSyncDefaultTimeoutFlag = cli.DurationFlag{
Name: "rpc.txsync.defaulttimeout",
Usage: "Default timeout for eth_sendRawTransactionSync (default: 25 secs).",
Value: rpccfg.DefaultRpcTxSyncDefaultTimeout,
}
RpcTxSyncMaxTimeoutFlag = cli.DurationFlag{
Name: "rpc.txsync.maxtimeout",
Usage: "Maximum allowed timeout for eth_sendRawTransactionSync (default: 1 min).",
Value: rpccfg.DefaultRpcTxSyncMaxTimeout,
}
TxpoolApiAddrFlag = cli.StringFlag{
Name: "txpool.api.addr",
Usage: "TxPool api network address, for example: 127.0.0.1:9090 (default: use value of --private.api.addr)",
}
TraceMaxtracesFlag = cli.UintFlag{
Name: "trace.maxtraces",
Usage: "Sets a limit on traces that can be returned in trace_filter",
Value: 200,
}
HTTPPathPrefixFlag = cli.StringFlag{
Name: "http.rpcprefix",
Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
Value: "",
}
TLSFlag = cli.BoolFlag{
Name: "tls",
Usage: "Enable TLS handshake",
}
TLSCertFlag = cli.StringFlag{
Name: "tls.cert",
Usage: "Specify certificate",
Value: "",
}
TLSKeyFlag = cli.StringFlag{
Name: "tls.key",
Usage: "Specify key file",
Value: "",
}
TLSCACertFlag = cli.StringFlag{
Name: "tls.cacert",
Usage: "Specify certificate authority",
Value: "",
}
WSEnabledFlag = cli.BoolFlag{
Name: "ws",
Usage: "Enable the WS-RPC server",
}
WSListenAddrFlag = cli.StringFlag{
Name: "ws.addr",
Usage: "WS-RPC server listening interface",
Value: nodecfg.DefaultWSHost,
}
WSPortFlag = cli.IntFlag{
Name: "ws.port",
Usage: "WS-RPC server listening port",
Value: nodecfg.DefaultWSPort,
}
WSApiFlag = cli.StringFlag{
Name: "ws.api",
Usage: "API's offered over the WS-RPC interface",
Value: "",
}
WSAllowedOriginsFlag = cli.StringFlag{
Name: "ws.origins",
Usage: "Origins from which to accept websockets requests",
Value: "",
}
WSPathPrefixFlag = cli.StringFlag{
Name: "ws.rpcprefix",
Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
Value: "",
}
WSSubscribeLogsChannelSize = cli.IntFlag{
Name: "ws.api.subscribelogs.channelsize",
Usage: "Size of the channel used for websocket logs subscriptions",
Value: 8192,
}
ExecFlag = cli.StringFlag{
Name: "exec",
Usage: "Execute JavaScript statement",
}
PreloadJSFlag = cli.StringFlag{
Name: "preload",
Usage: "Comma separated list of JavaScript files to preload into the console",
}
AllowUnprotectedTxs = cli.BoolFlag{
Name: "rpc.allow-unprotected-txs",
Usage: "Allow for unprotected (non-EIP155 signed) transactions to be submitted via RPC",
}
StateCacheFlag = cli.StringFlag{
Name: "state.cache",
Value: "0MB",
Usage: "Amount of data to store in StateCache (enabled if no --datadir set). Set 0 to disable StateCache. Defaults to 0MB",
}
// Network Settings
MaxPeersFlag = cli.IntFlag{
Name: "maxpeers",
Usage: "Maximum number of network peers per protocol version (network disabled if set to 0)",
Value: nodecfg.DefaultConfig.P2P.MaxPeers,
}
MaxPendingPeersFlag = cli.IntFlag{
Name: "maxpendpeers",
Usage: "Maximum number of TCP connections pending to become connected peers (per protocol version)",
Value: nodecfg.DefaultConfig.P2P.MaxPendingPeers,
}
ListenPortFlag = cli.IntFlag{
Name: "port",
Usage: "Network listening port",
Value: 30303,
}
P2pProtocolVersionFlag = cli.UintSliceFlag{
Name: "p2p.protocol",
Usage: "Version of eth p2p protocol",
Value: cli.NewUintSlice(nodecfg.DefaultConfig.P2P.ProtocolVersion...),
}
P2pProtocolAllowedPorts = cli.UintSliceFlag{
Name: "p2p.allowed-ports",
Usage: "Allowed ports to pick for different eth p2p protocol versions as follows <porta>,<portb>,..,<porti>",
Value: cli.NewUintSlice(uint(ListenPortFlag.Value), 30304, 30305, 30306, 30307),
}
SentryAddrFlag = cli.StringFlag{
Name: "sentry.api.addr",
Usage: "Comma separated sentry addresses '<host>:<port>,<host>:<port>'",
}
SentryLogPeerInfoFlag = cli.BoolFlag{
Name: "sentry.log-peer-info",
Usage: "Log detailed peer info when a peer connects or disconnects. Enable to integrate with observer.",
}
DownloaderAddrFlag = cli.StringFlag{
Name: "downloader.api.addr",
Usage: "downloader address '<host>:<port>'",
}
BootnodesFlag = cli.StringFlag{
Name: "bootnodes",
Usage: "Comma separated enode URLs for P2P discovery bootstrap",
Value: "",
}
StaticPeersFlag = cli.StringFlag{
Name: "staticpeers",
Usage: "Comma separated enode URLs to connect to",
Value: "",
}
TrustedPeersFlag = cli.StringFlag{
Name: "trustedpeers",
Usage: "Comma separated enode URLs which are always allowed to connect, even above the peer limit",
Value: "",
}
NodeKeyFileFlag = cli.StringFlag{
Name: "nodekey",
Usage: "P2P node key file",
}
NodeKeyHexFlag = cli.StringFlag{
Name: "nodekeyhex",
Usage: "P2P node key as hex (for testing)",
}
NATFlag = cli.StringFlag{
Name: "nat",
Usage: `NAT port mapping mechanism (any|none|upnp|pmp|stun|extip:<IP>)
"" or "none" Default - do not nat
"extip:77.12.33.4" Will assume the local machine is reachable on the given IP
"any" Uses the first auto-detected mechanism
"upnp" Uses the Universal Plug and Play protocol
"pmp" Uses NAT-PMP with an auto-detected gateway address
"pmp:192.168.0.1" Uses NAT-PMP with the given gateway address
"stun" Uses STUN to detect an external IP using a default server
"stun:<server>" Uses STUN to detect an external IP using the given server (host:port)
`,
Value: "",
}
NoDiscoverFlag = cli.BoolFlag{
Name: "nodiscover",
Usage: "Disables the peer discovery mechanism (manual peer addition)",
}
DiscoveryV4Flag = cli.BoolFlag{
Name: "discovery.v4",
Aliases: []string{"discv4"},
Usage: "Enables the V4 discovery mechanism",
Value: nodecfg.DefaultConfig.P2P.DiscoveryV4,
}
DiscoveryV5Flag = cli.BoolFlag{
Name: "discovery.v5",
// The first is for old Geth style, and the second is Erigon backward compatibility.
Aliases: []string{"discv5", "v5disc"},
Usage: "Enables the V5 discovery mechanism",
Value: nodecfg.DefaultConfig.P2P.DiscoveryV5,
}
NetrestrictFlag = cli.StringFlag{
Name: "netrestrict",
Usage: "Restricts network communication to the given IP networks (CIDR masks)",
}
DNSDiscoveryFlag = cli.StringFlag{
Name: "discovery.dns",
Usage: "Sets DNS discovery entry points (use \"\" to disable DNS)",
}
// ATM the url is left to the user and deployment to
JSpathFlag = cli.StringFlag{
Name: "jspath",
Usage: "JavaScript root path for `loadScript`",
Value: ".",
}
// Gas price oracle settings
GpoBlocksFlag = cli.IntFlag{
Name: "gpo.blocks",
Usage: "Number of recent blocks to check for gas prices",
Value: ethconfig.Defaults.GPO.Blocks,
}
GpoPercentileFlag = cli.IntFlag{
Name: "gpo.percentile",
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices",
Value: ethconfig.Defaults.GPO.Percentile,
}
GpoMaxGasPriceFlag = cli.Uint64Flag{
Name: "gpo.maxprice",
Usage: "Maximum gas price will be recommended by gpo",
Value: ethconfig.Defaults.GPO.MaxPrice.Uint64(),
}
// Metrics flags
MetricsEnabledFlag = cli.BoolFlag{
Name: "metrics",
Usage: "Enable metrics collection and reporting",
}
// MetricsHTTPFlag defines the endpoint for a stand-alone metrics HTTP endpoint.
// Since the pprof service enables sensitive/vulnerable behavior, this allows a user
// to enable a public-OK metrics endpoint without having to worry about ALSO exposing
// other profiling behavior or information.
MetricsHTTPFlag = cli.StringFlag{
Name: "metrics.addr",
Usage: "Enable stand-alone metrics HTTP server listening interface",
Value: metrics.DefaultConfig.HTTP,
}
MetricsPortFlag = cli.IntFlag{
Name: "metrics.port",
Usage: "Metrics HTTP server listening port",
Value: metrics.DefaultConfig.Port,
}
SnapKeepBlocksFlag = cli.BoolFlag{
Name: ethconfig.FlagSnapKeepBlocks,
Usage: "Keep ancient blocks in db (useful for debug)",
}
SnapStopFlag = cli.BoolFlag{
Name: ethconfig.FlagSnapStop,
Usage: "Workaround to stop producing new snapshots, if you meet some snapshots-related critical bug. It will stop move historical data from DB to new immutable snapshots. DB will grow and may slightly slow-down - and removing this flag in future will not fix this effect (db size will not greatly reduce).",
}
SnapStateStopFlag = cli.BoolFlag{
Name: ethconfig.FlagSnapStateStop,
Usage: "Workaround to stop producing new state files, if you meet some state-related critical bug. It will stop aggregate DB history in a state files. DB will grow and may slightly slow-down - and removing this flag in future will not fix this effect (db size will not greatly reduce).",
}
SnapSkipStateSnapshotDownloadFlag = cli.BoolFlag{
Name: "snap.skip-state-snapshot-download",
Usage: "Skip state download and start from genesis block",
Value: false,
}
SnapP2PManifestFlag = cli.BoolFlag{
Name: "snap.p2p-manifest",
Usage: "Discover snapshot manifest (chain.toml) from P2P peers via ENR instead of using centralized preverified.toml",
}
SnapDownloadToBlockFlag = cli.Uint64Flag{
Name: "snap.download.to.block",
Usage: "Download snapshots up to the given block number (exclusive). Disabled by default. Useful for testing and shadow forks.",
Aliases: []string{"shadow.fork.block"},
}
TorrentVerbosityFlag = cli.IntFlag{
Name: "torrent.verbosity",
Value: 1,
Usage: "0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (must set --verbosity to equal or higher level)",
}
TorrentDownloadRateFlag = cli.StringFlag{
Name: "torrent.download.rate",
// Default for 3.1. Try not drain the whole swarm by default.
Value: "512mb",
Usage: "Bytes per second, example: 32mb. Set Inf for no limit. Shared with webseeds unless that rate is set separately.",
}
// Decided to not provide a default to keep things simpler (so it shares whatever
// TorrentDownloadRateFlag is set to).
TorrentWebseedDownloadRateFlag = cli.StringFlag{
Name: "torrent.webseed.download.rate",
Usage: "Bytes per second for webseeds, example: 32mb. Set Inf for no limit. If not set, rate limit is shared with torrent.download.rate",
}
TorrentUploadRateFlag = cli.StringFlag{
Name: "torrent.upload.rate",
// Agreed in meeting to leave it quite a bit higher than 3.0 unless it becomes a problem.
Value: "16mb",
Usage: "Bytes per second, example: 32mb. Set Inf for no limit.",
}
// Deprecated (v3.0): This flag no longer has any effect and will be removed in a future release.
// The downloader now manages concurrent downloads automatically based on available resources.
// Previously controlled the number of files to download in parallel, but this is now handled
// internally by the BitTorrent client's resource management.
TorrentDownloadSlotsFlag = cli.IntFlag{
Name: "torrent.download.slots",
Value: 32, // Keep default for backward compatibility
Usage: "(DEPRECATED: No longer has any effect) Amount of files to download in parallel.",
Hidden: true,
}
// TODO: Currently unused.
TorrentStaticPeersFlag = cli.StringFlag{
Name: "torrent.staticpeers",
Usage: "Comma separated host:port to connect to",
Value: "",
Hidden: true,
}
TorrentDisableTrackers = cli.BoolFlag{
Name: "torrent.trackers.disable",
Usage: "Disable conventional BitTorrent trackers",
}
NoDownloaderFlag = cli.BoolFlag{
Name: "no-downloader",
Usage: "Disables downloader component",
}
DownloaderVerifyFlag = cli.BoolFlag{
Name: "downloader.verify",
Usage: "Verify snapshots on startup. It will not report problems found, but re-download broken pieces.",
}
DisableIPV6 = cli.BoolFlag{
Name: "downloader.disable.ipv6",
Usage: "Turns off ipv6 for the downloader",
Value: false,
}
DisableIPV4 = cli.BoolFlag{
Name: "downloader.disable.ipv4",
Usage: "Turns off ipv4 for the downloader",
Value: false,
}
TorrentPortFlag = cli.IntFlag{
Name: "torrent.port",
Value: 42069,
Usage: "Port to listen and serve BitTorrent protocol",
}
TorrentMaxPeersFlag = cli.IntFlag{
Name: "torrent.maxpeers",
Value: 100,
Usage: "Unused parameter (reserved for future use)",
}
TorrentConnsPerFileFlag = cli.IntFlag{
Name: "torrent.conns.perfile",
Value: 10,
Usage: "Number of connections per file",
}
DbPageSizeFlag = cli.StringFlag{
Name: "db.pagesize",
Usage: "DB is split to 'pages' of fixed size. Can't change DB creation. Must be power of 2 and '256b <= pagesize <= 64kb'. Default: equal to OperationSystem's pageSize. Bigger pageSize causing: 1. More writes to disk during commit 2. Smaller b-tree high 3. Less fragmentation 4. Less overhead on 'free-pages list' maintenance (a bit faster Put/Commit) 5. If expecting DB-size > 8Tb then set pageSize >= 8Kb",
Value: ethconfig.DefaultChainDBPageSize.String(),
}
DbSizeLimitFlag = cli.StringFlag{
Name: "db.size.limit",
Usage: "Runtime limit of chaindata db size (can change at any time)",
Value: (1 * datasize.TB).String(),
}
DbWriteMapFlag = cli.BoolFlag{
Name: "db.writemap",
Usage: "Enable WRITE_MAP feature for fast database writes and fast commit times",
Value: true,
}
HealthCheckFlag = cli.BoolFlag{
Name: "healthcheck",
Usage: "Enable grpc health check",
}
WebSeedsFlag = cli.StringFlag{
Name: "webseed",
Usage: "Comma-separated URL's, holding metadata about network-support infrastructure (like S3 buckets with snapshots, bootnodes, etc...)",
Value: "",
}
HeimdallURLFlag = cli.StringFlag{
Name: "bor.heimdall",
Usage: "URL of Heimdall service",
Value: "http://localhost:1317",
}
// WithoutHeimdallFlag no heimdall (for testing purpose)
WithoutHeimdallFlag = cli.BoolFlag{
Name: "bor.withoutheimdall",
Usage: "Run without Heimdall service (for testing purposes)",
}
BorBlockPeriodFlag = cli.BoolFlag{
Name: "bor.period",
Usage: "Override the bor block period (for testing purposes)",
}
BorBlockSizeFlag = cli.BoolFlag{
Name: "bor.minblocksize",
Usage: "Ignore the bor block period and wait for 'blocksize' transactions (for testing purposes)",
}
AAFlag = cli.BoolFlag{
Name: "aa",
Usage: "Enable AA transactions",
Value: false,
}
ConfigFlag = cli.StringFlag{
Name: "config",
Usage: "Sets erigon flags from YAML/TOML file",
Value: "",
}
CaplinDiscoveryAddrFlag = cli.StringFlag{
Name: "caplin.discovery.addr",
Usage: "Address for Caplin DISCV5 protocol",
Value: "0.0.0.0",
}
CaplinDiscoveryPortFlag = cli.Uint64Flag{
Name: "caplin.discovery.port",
Usage: "Port for Caplin DISCV5 protocol",
Value: 4000,
}
CaplinDiscoveryTCPPortFlag = cli.Uint64Flag{
Name: "caplin.discovery.tcpport",
Usage: "TCP Port for Caplin DISCV5 protocol",
Value: 4001,
}
CaplinEnableUPNPlag = cli.BoolFlag{
Name: "caplin.enable-upnp",
Usage: "Enable NAT porting for Caplin",
Value: false,
}
CaplinNATFlag = cli.StringFlag{
Name: "caplin.nat",
Usage: `NAT port mapping for Caplin P2P. Sets the external IP advertised in the discv5 ENR and libp2p
multiaddrs while the socket still binds to --caplin.discovery.addr (typically 0.0.0.0).
Required when running inside Docker or behind NAT to allow incoming peer connections.
"" Default — no NAT, use bind address as-is
"extip:1.2.3.4" Explicit public IP (recommended for VPS/Docker with static IP)
"stun" Detect public IP via STUN (default server: stun.l.google.com:19302)
"stun:<host>" Detect public IP via STUN using a custom server
"upnp" Use UPnP to discover external IP and map ports (home routers)
"pmp" Use NAT-PMP with auto-detected gateway
"pmp:192.168.0.1" Use NAT-PMP with explicit gateway`,
Value: "",
}
CaplinMaxInboundTrafficPerPeerFlag = cli.StringFlag{
Name: "caplin.max-inbound-traffic-per-peer",
Usage: "Max inbound traffic per second per peer",
Value: "1MB",
}
CaplinMaxOutboundTrafficPerPeerFlag = cli.StringFlag{
Name: "caplin.max-outbound-traffic-per-peer",
Usage: "Max outbound traffic per second per peer",
Value: "1MB",
}
CaplinAdaptableTrafficRequirementsFlag = cli.BoolFlag{
Name: "caplin.adaptable-maximum-traffic-requirements",
Usage: "Make the node adaptable to the maximum traffic requirement based on how many validators are being ran",
Value: true,
}
CaplinCheckpointSyncUrlFlag = cli.StringSliceFlag{
Name: "caplin.checkpoint-sync-url",
Usage: "checkpoint sync endpoint",
Value: cli.NewStringSlice(),
}
CaplinSubscribeAllTopicsFlag = cli.BoolFlag{
Name: "caplin.subscribe-all-topics",
Usage: "Subscribe to all gossip topics",
Value: false,
}
CaplinMevRelayUrl = cli.StringFlag{
Name: "caplin.mev-relay-url",
Usage: "MEV relay endpoint. Caplin runs in builder mode if this is set",
Value: "",
}
CaplinValidatorMonitorFlag = cli.BoolFlag{
Name: "caplin.validator-monitor",
Usage: "Enable caplin validator monitoring metrics",
Value: false,
}
CaplinMaxPeerCount = cli.Uint64Flag{
Name: "caplin.max-peer-count",
Usage: "Max number of peers to connect",
Value: 128,
}
CaplinUseEngineApiFlag = cli.BoolFlag{
Name: "caplin.use-engine-api",
Usage: "Use engine API for internal Caplin. useful for testing and if CL network is degraded",
Value: false,
}
SentinelAddrFlag = cli.StringFlag{
Name: "sentinel.addr",
Usage: "Address for sentinel",
Value: "localhost",
}
SentinelPortFlag = cli.Uint64Flag{
Name: "sentinel.port",
Usage: "Port for sentinel",
Value: 7777,
}
SentinelBootnodes = cli.StringSliceFlag{
Name: "sentinel.bootnodes",
Usage: "Comma separated enode URLs for P2P discovery bootstrap",
Value: cli.NewStringSlice(),
}
SentinelStaticPeers = cli.StringSliceFlag{
Name: "sentinel.staticpeers",
Usage: "connect to comma-separated Consensus static peers",
Value: cli.NewStringSlice(),
}
OtsSearchMaxCapFlag = cli.Uint64Flag{
Name: "ots.search.max.pagesize",
Usage: "Max allowed page size for search methods",
Value: 25,
}
BeaconAPIFlag = cli.StringSliceFlag{
Name: "beacon.api",
Usage: "Enable beacon API (available endpoints: beacon, builder, config, debug, events, node, validator, lighthouse)",
}
BeaconApiProtocolFlag = cli.StringFlag{
Name: "beacon.api.protocol",
Usage: "Protocol for beacon API",
Value: "tcp",
}
BeaconApiReadTimeoutFlag = cli.Uint64Flag{
Name: "beacon.api.read.timeout",
Usage: "Sets the seconds for a read time out in the beacon api",
Value: 5,
}
BeaconApiWriteTimeoutFlag = cli.Uint64Flag{
Name: "beacon.api.write.timeout",
Usage: "Sets the seconds for a write time out in the beacon api",
Value: 31536000,
}
BeaconApiIdleTimeoutFlag = cli.Uint64Flag{
Name: "beacon.api.idle.timeout",
Usage: "Sets the seconds for a write time out in the beacon api",
Value: 25,
}
BeaconApiAddrFlag = cli.StringFlag{
Name: "beacon.api.addr",
Usage: "sets the host to listen for beacon api requests",
Value: "localhost",
}
BeaconApiPortFlag = cli.UintFlag{
Name: "beacon.api.port",
Usage: "sets the port to listen for beacon api requests",
Value: 5555,
}
RPCSlowFlag = cli.DurationFlag{