github.com/klaytn/klaytn@v1.12.1/cmd/utils/flags.go (about) 1 // Modifications Copyright 2018 The klaytn Authors 2 // Copyright 2015 The go-ethereum Authors 3 // This file is part of go-ethereum. 4 // 5 // go-ethereum is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // go-ethereum is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>. 17 // 18 // This file is derived from cmd/utils/flags.go (2018/06/04). 19 // Modified and improved for the klaytn development. 20 21 package utils 22 23 import ( 24 "fmt" 25 "os" 26 "path/filepath" 27 "strings" 28 "time" 29 30 "github.com/klaytn/klaytn/blockchain" 31 "github.com/klaytn/klaytn/common" 32 "github.com/klaytn/klaytn/datasync/chaindatafetcher" 33 "github.com/klaytn/klaytn/datasync/chaindatafetcher/kafka" 34 "github.com/klaytn/klaytn/datasync/dbsyncer" 35 "github.com/klaytn/klaytn/log" 36 metricutils "github.com/klaytn/klaytn/metrics/utils" 37 "github.com/klaytn/klaytn/networks/rpc" 38 "github.com/klaytn/klaytn/node" 39 "github.com/klaytn/klaytn/node/cn" 40 "github.com/klaytn/klaytn/node/cn/filters" 41 "github.com/klaytn/klaytn/node/sc" 42 "github.com/klaytn/klaytn/params" 43 "github.com/klaytn/klaytn/storage/database" 44 "github.com/klaytn/klaytn/storage/statedb" 45 "github.com/urfave/cli/v2" 46 ) 47 48 func init() { 49 cli.FlagStringer = FlagString 50 } 51 52 // NewApp creates an app with sane defaults. 53 func NewApp(gitCommit, usage string) *cli.App { 54 app := cli.NewApp() 55 app.Name = filepath.Base(os.Args[0]) 56 // app.Author = "" 57 // app.Authors = nil 58 // app.Email = "" 59 app.Version = params.Version 60 if len(gitCommit) >= 8 { 61 app.Version += "-" + gitCommit[:8] 62 } 63 app.Usage = usage 64 return app 65 } 66 67 var ( 68 // General settings 69 ConfFlag = &cli.StringFlag{ 70 Name: "conf", 71 } 72 NtpDisableFlag = &cli.BoolFlag{ 73 Name: "ntp.disable", 74 Usage: "Disable checking if the local time is synchronized with ntp server. If this flag is not set, the local time is checked with the time of the server specified by ntp.server.", 75 Value: false, 76 Aliases: []string{"common.ntp.disable"}, 77 EnvVars: []string{"KLAYTN_NTP_DISABLE"}, 78 Category: "KLAY", 79 } 80 NtpServerFlag = &cli.StringFlag{ 81 Name: "ntp.server", 82 Usage: "Remote ntp server:port to get the time", 83 Value: "pool.ntp.org:123", 84 Aliases: []string{"common.ntp.server", "ns"}, 85 EnvVars: []string{"KLAYTN_NTP_SERVER"}, 86 Category: "KLAY", 87 } 88 NetworkTypeFlag = &cli.StringFlag{ 89 Name: "networktype", 90 Usage: "Klaytn network type (main-net (mn), service chain-net (scn))", 91 Value: "mn", 92 Aliases: []string{}, 93 EnvVars: []string{"KLAYTN_NETWORKTYPE"}, 94 } 95 DbTypeFlag = &cli.StringFlag{ 96 Name: "dbtype", 97 Usage: `Blockchain storage database type ("LevelDB", "BadgerDB", "MemoryDB", "DynamoDBS3")`, 98 Value: "LevelDB", 99 Aliases: []string{"db.type", "migration.src.dbtype"}, 100 EnvVars: []string{"KLAYTN_DBTYPE"}, 101 Category: "KLAY", 102 } 103 SrvTypeFlag = &cli.StringFlag{ 104 Name: "srvtype", 105 Usage: `json rpc server type ("http", "fasthttp")`, 106 Value: "fasthttp", 107 Aliases: []string{"common.srvtype"}, 108 EnvVars: []string{"KLAYTN_SRVTYPE"}, 109 Category: "KLAY", 110 } 111 DataDirFlag = &cli.PathFlag{ 112 Name: "datadir", 113 Value: node.DefaultDataDir(), 114 Usage: "Data directory for the databases and keystore. This value is only used in local DB.", 115 Aliases: []string{"common.datadir", "migration.src.datadir"}, 116 EnvVars: []string{"KLAYTN_DATADIR"}, 117 Category: "KLAY", 118 } 119 ChainDataDirFlag = &cli.PathFlag{ 120 Name: "chaindatadir", 121 Value: "", 122 Usage: "Data directory for chaindata. If this is not specified, chaindata is stored in datadir", 123 Aliases: []string{"common.chaindatadir"}, 124 EnvVars: []string{"KLAYTN_CHAINDATADIR"}, 125 Category: "KLAY", 126 } 127 KeyStoreDirFlag = &cli.PathFlag{ 128 Name: "keystore", 129 Usage: "Directory for the keystore (default = inside the datadir)", 130 Aliases: []string{"common.keystore"}, 131 EnvVars: []string{"KLAYTN_KEYSTORE"}, 132 Category: "ACCOUNT", 133 } 134 // TODO-Klaytn-Bootnode: redefine networkid 135 NetworkIdFlag = &cli.Uint64Flag{ 136 Name: "networkid", 137 Usage: "Network identifier (integer, 8217=Cypress (Mainnet) , 1000=Aspen, 1001=Baobab)", 138 Value: cn.GetDefaultConfig().NetworkId, 139 Aliases: []string{"p2p.network-id"}, 140 EnvVars: []string{"KLAYTN_NETWORKID"}, 141 Category: "NETWORK", 142 } 143 IdentityFlag = &cli.StringFlag{ 144 Name: "identity", 145 Usage: "Custom node name", 146 Aliases: []string{"common.identity"}, 147 EnvVars: []string{"KLAYTN_IDENTITY"}, 148 Category: "KLAY", 149 } 150 DocRootFlag = &cli.PathFlag{ 151 Name: "docroot", 152 Usage: "Document Root for HTTPClient file scheme", 153 // Value: DirectoryString{homeDir()}, 154 Value: homeDir(), 155 Aliases: []string{"common.docroot"}, 156 EnvVars: []string{"KLAYTN_DOCROOT"}, 157 Category: "KLAY", 158 } 159 defaultSyncMode = cn.GetDefaultConfig().SyncMode 160 SyncModeFlag = &TextMarshalerFlag{ 161 Name: "syncmode", 162 Usage: `Blockchain sync mode ("full" or "snap")`, 163 Value: &defaultSyncMode, 164 Aliases: []string{"common.syncmode"}, 165 EnvVars: []string{"KLAYTN_SYNCMODE"}, 166 Category: "KLAY", 167 } 168 GCModeFlag = &cli.StringFlag{ 169 Name: "gcmode", 170 Usage: `Blockchain garbage collection mode ("full", "archive")`, 171 Value: "full", 172 Aliases: []string{"common.garbage-collection-mode"}, 173 EnvVars: []string{"KLAYTN_GCMODE"}, 174 Category: "KLAY", 175 } 176 LightKDFFlag = &cli.BoolFlag{ 177 Name: "lightkdf", 178 Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", 179 Aliases: []string{"common.light-kdf"}, 180 EnvVars: []string{"KLAYTN_LIGHTKDF"}, 181 Category: "ACCOUNT", 182 } 183 OverwriteGenesisFlag = &cli.BoolFlag{ 184 Name: "overwrite-genesis", 185 Usage: "Overwrites genesis block with the given new genesis block for testing purpose", 186 Aliases: []string{"common.overwrite-genesis"}, 187 EnvVars: []string{"KLAYTN_OVERWRITE_GENESIS"}, 188 Category: "KLAY", 189 } 190 StartBlockNumberFlag = &cli.Uint64Flag{ 191 Name: "start-block-num", 192 Usage: "Starts the node from the given block number. Starting from 0 is not supported.", 193 Aliases: []string{"common.start-block-num"}, 194 EnvVars: []string{"KLAYTN_START_BLOCK_NUM"}, 195 Category: "KLAY", 196 } 197 // Transaction pool settings 198 TxPoolNoLocalsFlag = &cli.BoolFlag{ 199 Name: "txpool.nolocals", 200 Usage: "Disables price exemptions for locally submitted transactions", 201 Aliases: []string{}, 202 EnvVars: []string{"KLAYTN_TXPOOL_NOLOCALS"}, 203 Category: "TXPOOL", 204 } 205 TxPoolAllowLocalAnchorTxFlag = &cli.BoolFlag{ 206 Name: "txpool.allow-local-anchortx", 207 Usage: "Allow locally submitted anchoring transactions", 208 Aliases: []string{}, 209 EnvVars: []string{"KLAYTN_TXPOOL_ALLOW_LOCAL_ANCHORTX"}, 210 Category: "TXPOOL", 211 } 212 TxPoolDenyRemoteTxFlag = &cli.BoolFlag{ 213 Name: "txpool.deny.remotetx", 214 Usage: "Deny remote transaction receiving from other peers. Use only for emergency cases", 215 Aliases: []string{"txpool.deny-remote-tx"}, 216 EnvVars: []string{"KLAYTN_TXPOOL_DENY_REMOTETX"}, 217 Category: "TXPOOL", 218 } 219 TxPoolJournalFlag = &cli.StringFlag{ 220 Name: "txpool.journal", 221 Usage: "Disk journal for local transaction to survive node restarts", 222 Value: blockchain.DefaultTxPoolConfig.Journal, 223 Aliases: []string{}, 224 EnvVars: []string{"KLAYTN_TXPOOL_JOURNAL"}, 225 Category: "TXPOOL", 226 } 227 TxPoolJournalIntervalFlag = &cli.DurationFlag{ 228 Name: "txpool.journal-interval", 229 Usage: "Time interval to regenerate the local transaction journal", 230 Value: blockchain.DefaultTxPoolConfig.JournalInterval, 231 Aliases: []string{}, 232 EnvVars: []string{"KLAYTN_TXPOOL_JOURNAL_INTERVAL"}, 233 Category: "TXPOOL", 234 } 235 TxPoolPriceLimitFlag = &cli.Uint64Flag{ 236 Name: "txpool.pricelimit", 237 Usage: "Minimum gas price limit to enforce for acceptance into the pool", 238 Value: cn.GetDefaultConfig().TxPool.PriceLimit, 239 Aliases: []string{"txpool.price-limit"}, 240 EnvVars: []string{"KLAYTN_TXPOOL_PRICELIMIT"}, 241 Category: "TXPOOL", 242 } 243 TxPoolPriceBumpFlag = &cli.Uint64Flag{ 244 Name: "txpool.pricebump", 245 Usage: "Price bump percentage to replace an already existing transaction", 246 Value: cn.GetDefaultConfig().TxPool.PriceBump, 247 Aliases: []string{"txpool.price-bump"}, 248 EnvVars: []string{"KLAYTN_TXPOOL_PRICEBUMP"}, 249 Category: "TXPOOL", 250 } 251 TxPoolExecSlotsAccountFlag = &cli.Uint64Flag{ 252 Name: "txpool.exec-slots.account", 253 Usage: "Number of executable transaction slots guaranteed per account", 254 Value: cn.GetDefaultConfig().TxPool.ExecSlotsAccount, 255 Aliases: []string{}, 256 EnvVars: []string{"KLAYTN_TXPOOL_EXEC_SLOTS_ACCOUNT"}, 257 Category: "TXPOOL", 258 } 259 TxPoolExecSlotsAllFlag = &cli.Uint64Flag{ 260 Name: "txpool.exec-slots.all", 261 Usage: "Maximum number of executable transaction slots for all accounts", 262 Value: cn.GetDefaultConfig().TxPool.ExecSlotsAll, 263 Aliases: []string{}, 264 EnvVars: []string{"KLAYTN_TXPOOL_EXEC_SLOTS_ALL"}, 265 Category: "TXPOOL", 266 } 267 TxPoolNonExecSlotsAccountFlag = &cli.Uint64Flag{ 268 Name: "txpool.nonexec-slots.account", 269 Usage: "Maximum number of non-executable transaction slots permitted per account", 270 Value: cn.GetDefaultConfig().TxPool.NonExecSlotsAccount, 271 Aliases: []string{}, 272 EnvVars: []string{"KLAYTN_TXPOOL_NONEXEC_SLOTS_ACCOUNT"}, 273 Category: "TXPOOL", 274 } 275 TxPoolNonExecSlotsAllFlag = &cli.Uint64Flag{ 276 Name: "txpool.nonexec-slots.all", 277 Usage: "Maximum number of non-executable transaction slots for all accounts", 278 Value: cn.GetDefaultConfig().TxPool.NonExecSlotsAll, 279 Aliases: []string{}, 280 EnvVars: []string{"KLAYTN_TXPOOL_NONEXEC_SLOTS_ALL"}, 281 Category: "TXPOOL", 282 } 283 TxPoolKeepLocalsFlag = &cli.BoolFlag{ 284 Name: "txpool.keeplocals", 285 Usage: "Disables removing timed-out local transactions", 286 Aliases: []string{}, 287 EnvVars: []string{"KLAYTN_TXPOOL_KEEPLOCALS"}, 288 Category: "TXPOOL", 289 } 290 TxPoolLifetimeFlag = &cli.DurationFlag{ 291 Name: "txpool.lifetime", 292 Usage: "Maximum amount of time non-executable transaction are queued", 293 Value: cn.GetDefaultConfig().TxPool.Lifetime, 294 Aliases: []string{}, 295 EnvVars: []string{"KLAYTN_TXPOOL_LIFETIME"}, 296 Category: "TXPOOL", 297 } 298 // PN specific txpool settings 299 TxPoolSpamThrottlerDisableFlag = &cli.BoolFlag{ 300 Name: "txpool.spamthrottler.disable", 301 Usage: "Disable txpool spam throttler prototype", 302 Aliases: []string{}, 303 EnvVars: []string{"KLAYTN_TXPOOL_SPAMTHROTTLER_DISABLE"}, 304 } 305 306 // KES 307 KESNodeTypeServiceFlag = &cli.BoolFlag{ 308 Name: "kes.nodetype.service", 309 Usage: "Run as a KES Service Node (Disable fetcher, downloader, and worker)", 310 Aliases: []string{"common.kes-nodetype-service"}, 311 EnvVars: []string{"KLAYTN_KES_NODETYPE_SERVICE"}, 312 Category: "MISC", 313 } 314 SingleDBFlag = &cli.BoolFlag{ 315 Name: "db.single", 316 Usage: "Create a single persistent storage. MiscDB, headerDB and etc are stored in one DB.", 317 Aliases: []string{"migration.src.single"}, 318 EnvVars: []string{"KLAYTN_DB_SINGLE"}, 319 Category: "DATABASE", 320 } 321 NumStateTrieShardsFlag = &cli.UintFlag{ 322 Name: "db.num-statetrie-shards", 323 Usage: "Number of internal shards of state trie DB shards. Should be power of 2", 324 Value: 4, 325 Aliases: []string{"migration.src.db.leveldb.num-statetrie-shards"}, 326 EnvVars: []string{"KLAYTN_DB_NUM_STATETRIE_SHARDS"}, 327 Category: "DATABASE", 328 } 329 LevelDBCacheSizeFlag = &cli.IntFlag{ 330 Name: "db.leveldb.cache-size", 331 Usage: "Size of in-memory cache in LevelDB (MiB)", 332 Value: 768, 333 Aliases: []string{"migration.src.db.leveldb.cache-size"}, 334 EnvVars: []string{"KLAYTN_DB_LEVELDB_CACHE_SIZE"}, 335 Category: "DATABASE", 336 } 337 // TODO-Klaytn-Database LevelDBCompressionTypeFlag should be removed before main-net release. 338 LevelDBCompressionTypeFlag = &cli.IntFlag{ 339 Name: "db.leveldb.compression", 340 Usage: "Determines the compression method for LevelDB. 0=AllNoCompression, 1=ReceiptOnlySnappyCompression, 2=StateTrieOnlyNoCompression, 3=AllSnappyCompression", 341 Value: 0, 342 Aliases: []string{"migration.src.db.leveldb.compression"}, 343 EnvVars: []string{"KLAYTN_DB_LEVELDB_COMPRESSION"}, 344 Category: "DATABASE", 345 } 346 LevelDBNoBufferPoolFlag = &cli.BoolFlag{ 347 Name: "db.leveldb.no-buffer-pool", 348 Usage: "Disables using buffer pool for LevelDB's block allocation", 349 Aliases: []string{}, 350 EnvVars: []string{"KLAYTN_DB_LEVELDB_NO_BUFFER_POOL"}, 351 Category: "DATABASE", 352 } 353 RocksDBSecondaryFlag = &cli.BoolFlag{ 354 Name: "db.rocksdb.secondary", 355 Usage: "Enable rocksdb secondary mode (read-only and catch-up with primary node dynamically)", 356 Aliases: []string{"migration.src.db.rocksdb.secondary"}, 357 EnvVars: []string{"KLAYTN_DB_ROCKSDB_SECONDARY"}, 358 Category: "DATABASE", 359 } 360 RocksDBCacheSizeFlag = &cli.Uint64Flag{ 361 Name: "db.rocksdb.cache-size", 362 Usage: "Size of in-memory cache in RocksDB (MiB)", 363 Value: 768, 364 Aliases: []string{"migration.src.db.rocksdb.cache-size"}, 365 EnvVars: []string{"KLAYTN_DB_ROCKSDB_CACHE_SIZE"}, 366 Category: "DATABASE", 367 } 368 RocksDBDumpMallocStatFlag = &cli.BoolFlag{ 369 Name: "db.rocksdb.dump-malloc-stat", 370 Usage: "Enable to print memory stat together with rocksdb.stat. Works with Jemalloc only.", 371 Aliases: []string{"migration.src.db.rocksdb.dump-malloc-stat"}, 372 EnvVars: []string{"KLAYTN_DB_ROCKSDB_DUMP_MALLOC_STAT"}, 373 Category: "DATABASE", 374 } 375 RocksDBCompressionTypeFlag = &cli.StringFlag{ 376 Name: "db.rocksdb.compression-type", 377 Usage: "RocksDB block compression type. Supported values are 'no', 'snappy', 'zlib', 'bz', 'lz4', 'lz4hc', 'xpress', 'zstd'", 378 Value: database.GetDefaultRocksDBConfig().CompressionType, 379 Aliases: []string{"migration.src.db.rocksdb.compression-type"}, 380 EnvVars: []string{"KLAYTN_DB_ROCKSDB_COMPRESSION_TYPE"}, 381 Category: "DATABASE", 382 } 383 RocksDBBottommostCompressionTypeFlag = &cli.StringFlag{ 384 Name: "db.rocksdb.bottommost-compression-type", 385 Usage: "RocksDB bottommost block compression type. Supported values are 'no', 'snappy', 'zlib', 'bz2', 'lz4', 'lz4hc', 'xpress', 'zstd'", 386 Value: database.GetDefaultRocksDBConfig().BottommostCompressionType, 387 Aliases: []string{"migration.src.db.rocksdb.bottommost-compression-type"}, 388 EnvVars: []string{"KLAYTN_DB_ROCKSDB_BOTTOMMOST_COMPRESSION_TYPE"}, 389 Category: "DATABASE", 390 } 391 RocksDBFilterPolicyFlag = &cli.StringFlag{ 392 Name: "db.rocksdb.filter-policy", 393 Usage: "RocksDB filter policy. Supported values are 'no', 'bloom', 'ribbon'", 394 Value: database.GetDefaultRocksDBConfig().FilterPolicy, 395 Aliases: []string{"migration.src.db.rocksdb.filter-policy"}, 396 EnvVars: []string{"KLAYTN_DB_ROCKSDB_FILTER_POLICY"}, 397 Category: "DATABASE", 398 } 399 RocksDBDisableMetricsFlag = &cli.BoolFlag{ 400 Name: "db.rocksdb.disable-metrics", 401 Usage: "Disable RocksDB metrics", 402 Aliases: []string{"migration.src.db.rocksdb.disable-metrics"}, 403 EnvVars: []string{"KLAYTN_DB_ROCKSDB_DISABLE_METRICS"}, 404 Category: "DATABASE", 405 } 406 RocksDBMaxOpenFilesFlag = &cli.IntFlag{ 407 Name: "db.rocksdb.max-open-files", 408 Usage: "Set RocksDB max open files. (the value should be greater than 16)", 409 Value: database.GetDefaultRocksDBConfig().MaxOpenFiles, 410 Aliases: []string{"migration.src.db.rocksdb.max-open-files"}, 411 EnvVars: []string{"KLAYTN_DB_ROCKSDB_MAX_OPEN_FILES"}, 412 Category: "DATABASE", 413 } 414 RocksDBCacheIndexAndFilterFlag = &cli.BoolFlag{ 415 Name: "db.rocksdb.cache-index-and-filter", 416 Usage: "Use block cache for index and filter blocks.", 417 Aliases: []string{"migration.src.db.rocksdb.cache-index-and-filter"}, 418 EnvVars: []string{"KLAYTN_DB_ROCKSDB_CACHE_INDEX_AND_FILTER"}, 419 Category: "DATABASE", 420 } 421 DynamoDBTableNameFlag = &cli.StringFlag{ 422 Name: "db.dynamo.tablename", 423 Usage: "Specifies DynamoDB table name. This is mandatory to use dynamoDB. (Set dbtype to use DynamoDBS3)", 424 Aliases: []string{"migration.src.db.dynamo.table-name", "db.dynamo.table-name"}, 425 EnvVars: []string{"KLAYTN_DB_DYNAMO_TABLENAME"}, 426 Category: "DATABASE", 427 } 428 DynamoDBRegionFlag = &cli.StringFlag{ 429 Name: "db.dynamo.region", 430 Usage: "AWS region where the DynamoDB will be created.", 431 Value: database.GetDefaultDynamoDBConfig().Region, 432 Aliases: []string{"migration.src.db.dynamo.region"}, 433 EnvVars: []string{"KLAYTN_DB_DYNAMO_REGION"}, 434 Category: "DATABASE", 435 } 436 DynamoDBIsProvisionedFlag = &cli.BoolFlag{ 437 Name: "db.dynamo.is-provisioned", 438 Usage: "Set DynamoDB billing mode to provision. The default billing mode is on-demand.", 439 Aliases: []string{"migration.src.db.dynamo.is-provisioned"}, 440 EnvVars: []string{"KLAYTN_DB_DYNAMO_IS_PROVISIONED"}, 441 Category: "DATABASE", 442 } 443 DynamoDBReadCapacityFlag = &cli.Int64Flag{ 444 Name: "db.dynamo.read-capacity", 445 Usage: "Read capacity unit of dynamoDB. If is-provisioned is not set, this flag will not be applied.", 446 Value: database.GetDefaultDynamoDBConfig().ReadCapacityUnits, 447 Aliases: []string{"migration.src.db.dynamo.read-capacity"}, 448 EnvVars: []string{"KLAYTN_DB_DYNAMO_READ_CAPACITY"}, 449 Category: "DATABASE", 450 } 451 DynamoDBWriteCapacityFlag = &cli.Int64Flag{ 452 Name: "db.dynamo.write-capacity", 453 Usage: "Write capacity unit of dynamoDB. If is-provisioned is not set, this flag will not be applied", 454 Value: database.GetDefaultDynamoDBConfig().WriteCapacityUnits, 455 Aliases: []string{"migration.src.db.dynamo.write-capacity"}, 456 EnvVars: []string{"KLAYTN_DB_DYNAMO_WRITE_CAPACITY"}, 457 Category: "DATABASE", 458 } 459 DynamoDBReadOnlyFlag = &cli.BoolFlag{ 460 Name: "db.dynamo.read-only", 461 Usage: "Disables write to DynamoDB. Only read is possible.", 462 Aliases: []string{}, 463 EnvVars: []string{"KLAYTN_DB_DYNAMO_READ_ONLY"}, 464 Category: "DATABASE", 465 } 466 NoParallelDBWriteFlag = &cli.BoolFlag{ 467 Name: "db.no-parallel-write", 468 Usage: "Disables parallel writes of block data to persistent database", 469 Aliases: []string{}, 470 EnvVars: []string{"KLAYTN_DB_NO_PARALLEL_WRITE"}, 471 Category: "DATABASE", 472 } 473 DBNoPerformanceMetricsFlag = &cli.BoolFlag{ 474 Name: "db.no-perf-metrics", 475 Usage: "Disables performance metrics of database's read and write operations", 476 Value: false, 477 Aliases: []string{"migration.no-perf-metrics"}, 478 EnvVars: []string{"KLAYTN_DB_NO_PERF_METRICS"}, 479 Category: "DATABASE", 480 } 481 SnapshotFlag = &cli.BoolFlag{ 482 Name: "snapshot", 483 Usage: "Enables snapshot-database mode", 484 Aliases: []string{"snapshot-database.enable"}, 485 EnvVars: []string{"KLAYTN_SNAPSHOT"}, 486 Category: "MISC", 487 } 488 SnapshotCacheSizeFlag = &cli.IntFlag{ 489 Name: "snapshot.cache-size", 490 Usage: "Size of in-memory cache of the state snapshot cache (in MiB)", 491 Value: 512, 492 Aliases: []string{"snapshot-database.cache-size"}, 493 EnvVars: []string{"KLAYTN_SNAPSHOT_CACHE_SIZE"}, 494 Category: "MISC", 495 } 496 SnapshotAsyncGen = &cli.BoolFlag{ 497 Name: "snapshot.async-gen", 498 Usage: "Enables snapshot data generation in background", 499 Value: true, 500 Aliases: []string{"snapshot-database.async-gen"}, 501 EnvVars: []string{"KLAYTN_SNAPSHOT_BACKGROUND_GENERATION"}, 502 Category: "MISC", 503 } 504 TrieMemoryCacheSizeFlag = &cli.IntFlag{ 505 Name: "state.cache-size", 506 Usage: "Size of in-memory cache of the global state (in MiB) to flush matured singleton trie nodes to disk", 507 Value: 512, 508 Aliases: []string{}, 509 EnvVars: []string{"KLAYTN_STATE_CACHE_SIZE"}, 510 Category: "STATE", 511 } 512 TrieBlockIntervalFlag = &cli.UintFlag{ 513 Name: "state.block-interval", 514 Usage: "An interval in terms of block number to commit the global state to disk", 515 Value: blockchain.DefaultBlockInterval, 516 Aliases: []string{}, 517 EnvVars: []string{"KLAYTN_STATE_BLOCK_INTERVAL"}, 518 Category: "STATE", 519 } 520 TriesInMemoryFlag = &cli.Uint64Flag{ 521 Name: "state.tries-in-memory", 522 Usage: "The number of recent state tries residing in the memory", 523 Value: blockchain.DefaultTriesInMemory, 524 Aliases: []string{}, 525 EnvVars: []string{"KLAYTN_STATE_TRIES_IN_MEMORY"}, 526 Category: "STATE", 527 } 528 LivePruningFlag = &cli.BoolFlag{ 529 Name: "state.live-pruning", 530 Usage: "Enable trie live pruning", 531 Aliases: []string{}, 532 EnvVars: []string{"KLAYTN_STATE_LIVE_PRUNING"}, 533 Category: "STATE", 534 } 535 LivePruningRetentionFlag = &cli.Uint64Flag{ 536 Name: "state.live-pruning-retention", 537 Usage: "Number of blocks from the latest block that are not to be pruned", 538 Value: blockchain.DefaultLivePruningRetention, 539 Aliases: []string{}, 540 EnvVars: []string{"KLAYTN_STATE_LIVE_PRUNING_RETENTION"}, 541 Category: "STATE", 542 } 543 CacheTypeFlag = &cli.IntFlag{ 544 Name: "cache.type", 545 Usage: "Cache Type: 0=LRUCache, 1=LRUShardCache, 2=FIFOCache", 546 Value: int(common.DefaultCacheType), 547 Aliases: []string{}, 548 EnvVars: []string{"KLAYTN_CACHE_TYPE"}, 549 Category: "CACHE", 550 } 551 CacheScaleFlag = &cli.IntFlag{ 552 Name: "cache.scale", 553 Usage: "Scale of cache (cache size = preset size * scale of cache(%))", 554 Aliases: []string{}, 555 EnvVars: []string{"KLAYTN_CACHE_SCALE"}, 556 Category: "CACHE", 557 } 558 CacheUsageLevelFlag = &cli.StringFlag{ 559 Name: "cache.level", 560 Usage: "Set the cache usage level ('saving', 'normal', 'extreme')", 561 Aliases: []string{}, 562 EnvVars: []string{"KLAYTN_CACHE_LEVEL"}, 563 Category: "CACHE", 564 } 565 MemorySizeFlag = &cli.IntFlag{ 566 Name: "cache.memory", 567 Usage: "Set the physical RAM size (GB, Default: 16GB)", 568 Aliases: []string{}, 569 EnvVars: []string{"KLAYTN_CACHE_MEMORY"}, 570 Category: "CACHE", 571 } 572 TrieNodeCacheTypeFlag = &cli.StringFlag{ 573 Name: "statedb.cache.type", 574 Usage: "Set trie node cache type ('LocalCache', 'RemoteCache', " + 575 "'HybridCache') (default = 'LocalCache')", 576 Value: string(statedb.CacheTypeLocal), 577 Aliases: []string{}, 578 EnvVars: []string{"KLAYTN_STATEDB_CACHE_TYPE"}, 579 Category: "CACHE", 580 } 581 NumFetcherPrefetchWorkerFlag = &cli.IntFlag{ 582 Name: "statedb.cache.num-fetcher-prefetch-worker", 583 Usage: "Number of workers used to prefetch block when fetcher fetches block", 584 Value: 32, 585 Aliases: []string{}, 586 EnvVars: []string{"KLAYTN_STATEDB_CACHE_NUM_FETCHER_PREFETCH_WORKER"}, 587 Category: "CACHE", 588 } 589 UseSnapshotForPrefetchFlag = &cli.BoolFlag{ 590 Name: "statedb.cache.use-snapshot-for-prefetch", 591 Usage: "Use state snapshot functionality while prefetching", 592 Aliases: []string{}, 593 EnvVars: []string{"KLAYTN_STATEDB_CACHE_USE_SNAPSHOT_FOR_PREFETCH"}, 594 Category: "CACHE", 595 } 596 TrieNodeCacheRedisEndpointsFlag = &cli.StringSliceFlag{ 597 Name: "statedb.cache.redis.endpoints", 598 Usage: "Set endpoints of redis trie node cache. More than one endpoints can be set", 599 Aliases: []string{}, 600 EnvVars: []string{"KLAYTN_STATEDB_CACHE_REDIS_ENDPOINTS"}, 601 Category: "CACHE", 602 } 603 TrieNodeCacheRedisClusterFlag = &cli.BoolFlag{ 604 Name: "statedb.cache.redis.cluster", 605 Usage: "Enables cluster-enabled mode of redis trie node cache", 606 Aliases: []string{}, 607 EnvVars: []string{"KLAYTN_STATEDB_CACHE_REDIS_CLUSTER"}, 608 Category: "CACHE", 609 } 610 TrieNodeCacheRedisPublishBlockFlag = &cli.BoolFlag{ 611 Name: "statedb.cache.redis.publish", 612 Usage: "Publishes every committed block to redis trie node cache", 613 Aliases: []string{}, 614 EnvVars: []string{"KLAYTN_STATEDB_CACHE_REDIS_PUBLISH"}, 615 Category: "CACHE", 616 } 617 TrieNodeCacheRedisSubscribeBlockFlag = &cli.BoolFlag{ 618 Name: "statedb.cache.redis.subscribe", 619 Usage: "Subscribes blocks from redis trie node cache", 620 Aliases: []string{}, 621 EnvVars: []string{"KLAYTN_STATEDB_CACHE_REDIS_SUBSCRIBE"}, 622 Category: "CACHE", 623 } 624 TrieNodeCacheLimitFlag = &cli.IntFlag{ 625 Name: "state.trie-cache-limit", 626 Usage: "Memory allowance (MiB) to use for caching trie nodes in memory. -1 is for auto-scaling", 627 Value: -1, 628 Aliases: []string{}, 629 EnvVars: []string{"KLAYTN_STATE_TRIE_CACHE_LIMIT"}, 630 Category: "CACHE", 631 } 632 TrieNodeCacheSavePeriodFlag = &cli.DurationFlag{ 633 Name: "state.trie-cache-save-period", 634 Usage: "Period of saving in memory trie cache to file if fastcache is used, 0 means disabled", 635 Value: 0, 636 Aliases: []string{}, 637 EnvVars: []string{"KLAYTN_STATE_TRIE_CACHE_SAVE_PERIOD"}, 638 Category: "CACHE", 639 } 640 641 SenderTxHashIndexingFlag = &cli.BoolFlag{ 642 Name: "sendertxhashindexing", 643 Usage: "Enables storing mapping information of senderTxHash to txHash", 644 Aliases: []string{"common.sender-tx-hash-indexing"}, 645 EnvVars: []string{"KLAYTN_SENDERTXHASHINDEXING"}, 646 Category: "DATABASE", 647 } 648 ChildChainIndexingFlag = &cli.BoolFlag{ 649 Name: "childchainindexing", 650 Usage: "Enables storing transaction hash of child chain transaction for fast access to child chain data", 651 Aliases: []string{"common.child-chain-indexing"}, 652 EnvVars: []string{"KLAYTN_CHILDCHAININDEXING"}, 653 Category: "SERVICECHAIN", 654 } 655 TargetGasLimitFlag = &cli.Uint64Flag{ 656 Name: "targetgaslimit", 657 Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine", 658 Value: params.GenesisGasLimit, 659 Aliases: []string{"common.target-gaslimit"}, 660 EnvVars: []string{"KLAYTN_TARGETGASLIMIT"}, 661 Category: "NETWORK", 662 } 663 ServiceChainSignerFlag = &cli.StringFlag{ 664 Name: "scsigner", 665 Usage: "Public address for signing blocks in the service chain (default = first account created)", 666 Value: "0", 667 Aliases: []string{"common.scsigner"}, 668 EnvVars: []string{"KLAYTN_SCSIGNER"}, 669 Category: "CONSENSUS", 670 } 671 RewardbaseFlag = &cli.StringFlag{ 672 Name: "rewardbase", 673 Usage: "Public address for block consensus rewards (default = first account created)", 674 Value: "0", 675 Aliases: []string{"common.rewardbase"}, 676 EnvVars: []string{"KLAYTN_REWARDBASE"}, 677 Category: "CONSENSUS", 678 } 679 ExtraDataFlag = &cli.StringFlag{ 680 Name: "extradata", 681 Usage: "Block extra data set by the work (default = client version)", 682 Aliases: []string{"common.block-extra-data"}, 683 EnvVars: []string{"KLAYTN_EXTRADATA"}, 684 Category: "KLAY", 685 } 686 687 TxResendIntervalFlag = &cli.Uint64Flag{ 688 Name: "txresend.interval", 689 Usage: "Set the transaction resend interval in seconds", 690 Value: uint64(cn.DefaultTxResendInterval), 691 Aliases: []string{}, 692 EnvVars: []string{"KLAYTN_TXRESEND_INTERVAL"}, 693 Category: "TXPOOL", 694 } 695 TxResendCountFlag = &cli.IntFlag{ 696 Name: "txresend.max-count", 697 Usage: "Set the max count of resending transactions", 698 Value: cn.DefaultMaxResendTxCount, 699 Aliases: []string{}, 700 EnvVars: []string{"KLAYTN_TXRESEND_MAX_COUNT"}, 701 Category: "TXPOOL", 702 } 703 // TODO-Klaytn-RemoveLater Remove this flag when we are confident with the new transaction resend logic 704 TxResendUseLegacyFlag = &cli.BoolFlag{ 705 Name: "txresend.use-legacy", 706 Usage: "Enable the legacy transaction resend logic (For testing only)", 707 Aliases: []string{}, 708 EnvVars: []string{"KLAYTN_TXRESEND_USE_LEGACY"}, 709 Category: "TXPOOL", 710 } 711 // Account settings 712 UnlockedAccountFlag = &cli.StringFlag{ 713 Name: "unlock", 714 Usage: "Comma separated list of accounts to unlock", 715 Value: "", 716 Aliases: []string{"account-update.unlock"}, 717 EnvVars: []string{"KLAYTN_UNLOCK"}, 718 Category: "ACCOUNT", 719 } 720 PasswordFileFlag = &cli.StringFlag{ 721 Name: "password", 722 Usage: "Password file to use for non-interactive password input", 723 Value: "", 724 Aliases: []string{"account-update.password"}, 725 EnvVars: []string{"KLAYTN_PASSWORD"}, 726 Category: "ACCOUNT", 727 } 728 729 VMEnableDebugFlag = &cli.BoolFlag{ 730 Name: "vmdebug", 731 Usage: "Record information useful for VM and contract debugging", 732 Aliases: []string{"vm.debug"}, 733 EnvVars: []string{"KLAYTN_VMDEBUG"}, 734 Category: "VIRTUAL MACHINE", 735 } 736 VMLogTargetFlag = &cli.IntFlag{ 737 Name: "vmlog", 738 Usage: "Set the output target of vmlog precompiled contract (0: no output, 1: file, 2: stdout, 3: both)", 739 Value: 0, 740 Aliases: []string{"vm.log"}, 741 EnvVars: []string{"KLAYTN_VMLOG"}, 742 Category: "VIRTUAL MACHINE", 743 } 744 VMTraceInternalTxFlag = &cli.BoolFlag{ 745 Name: "vm.internaltx", 746 Usage: "Collect internal transaction data while processing a block", 747 Aliases: []string{}, 748 EnvVars: []string{"KLAYTN_VM_INTERNALTX"}, 749 Category: "VIRTUAL MACHINE", 750 } 751 VMOpDebugFlag = &cli.BoolFlag{ 752 Name: "vm.opdebug", 753 Usage: "Collect and print the execution time of opcodes when node stops", 754 Aliases: []string{}, 755 EnvVars: []string{"KLAYTN_VM_OPDEBUG"}, 756 Category: "VIRTUAL MACHINE", 757 } 758 759 // Logging and debug settings 760 MetricsEnabledFlag = &cli.BoolFlag{ 761 Name: metricutils.MetricsEnabledFlag, 762 Usage: "Enable metrics collection and reporting", 763 Aliases: []string{"metrics-collection-reporting.enable"}, 764 EnvVars: []string{"KLAYTN_METRICUTILS_METRICSENABLEDFLAG"}, 765 Category: "METRIC", 766 } 767 PrometheusExporterFlag = &cli.BoolFlag{ 768 Name: metricutils.PrometheusExporterFlag, 769 Usage: "Enable prometheus exporter", 770 Aliases: []string{"metrics-collection-reporting.prometheus"}, 771 EnvVars: []string{"KLAYTN_METRICUTILS_PROMETHEUSEXPORTERFLAG"}, 772 Category: "METRIC", 773 } 774 PrometheusExporterPortFlag = &cli.IntFlag{ 775 Name: metricutils.PrometheusExporterPortFlag, 776 Usage: "Prometheus exporter listening port", 777 Value: 61001, 778 Aliases: []string{"metrics-collection-reporting.prometheus-port"}, 779 EnvVars: []string{"KLAYTN_METRICUTILS_PROMETHEUSEXPORTERPORTFLAG"}, 780 Category: "METRIC", 781 } 782 783 // RPC settings 784 RPCEnabledFlag = &cli.BoolFlag{ 785 Name: "rpc", 786 Usage: "Enable the HTTP-RPC server", 787 Aliases: []string{"http-rpc.enable"}, 788 EnvVars: []string{"KLAYTN_RPC"}, 789 Category: "API AND CONSOLE", 790 } 791 RPCListenAddrFlag = &cli.StringFlag{ 792 Name: "rpcaddr", 793 Usage: "HTTP-RPC server listening interface", 794 Value: node.DefaultHTTPHost, 795 Aliases: []string{"http-rpc.addr"}, 796 EnvVars: []string{"KLAYTN_RPCADDR"}, 797 Category: "API AND CONSOLE", 798 } 799 RPCPortFlag = &cli.IntFlag{ 800 Name: "rpcport", 801 Usage: "HTTP-RPC server listening port", 802 Value: node.DefaultHTTPPort, 803 Aliases: []string{"http-rpc.port"}, 804 EnvVars: []string{"KLAYTN_RPCPORT"}, 805 Category: "API AND CONSOLE", 806 } 807 RPCCORSDomainFlag = &cli.StringFlag{ 808 Name: "rpccorsdomain", 809 Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)", 810 Value: "", 811 Aliases: []string{"http-rpc.cors-domain"}, 812 EnvVars: []string{"KLAYTN_RPCCORSDOMAIN"}, 813 Category: "API AND CONSOLE", 814 } 815 RPCVirtualHostsFlag = &cli.StringFlag{ 816 Name: "rpcvhosts", 817 Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.", 818 Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","), 819 Aliases: []string{"http-rpc.vhosts"}, 820 EnvVars: []string{"KLAYTN_RPCVHOSTS"}, 821 Category: "API AND CONSOLE", 822 } 823 RPCApiFlag = &cli.StringFlag{ 824 Name: "rpcapi", 825 Usage: "API's offered over the HTTP-RPC interface", 826 Value: "", 827 Aliases: []string{"http-rpc.api"}, 828 EnvVars: []string{"KLAYTN_RPCAPI"}, 829 Category: "API AND CONSOLE", 830 } 831 RPCGlobalGasCap = &cli.Uint64Flag{ 832 Name: "rpc.gascap", 833 Usage: "Sets a cap on gas in {eth,klay}_{call,estimateGas,estimateComputationCost} (0 = no cap)", 834 Aliases: []string{"http-rpc.gascap"}, 835 EnvVars: []string{"KLAYTN_RPC_GASCAP"}, 836 Category: "API AND CONSOLE", 837 } 838 RPCGlobalEVMTimeoutFlag = &cli.DurationFlag{ 839 Name: "rpc.evmtimeout", 840 Usage: "Sets a timeout in {eth,klay}_{call,estimateGas,estimateComputationCost}. (0 = apply http-rpc.execution.timeout)", 841 Aliases: []string{"http-rpc.evmtimeout"}, 842 EnvVars: []string{"KLAYTN_RPC_EVMTIMEOUT"}, 843 Category: "API AND CONSOLE", 844 } 845 RPCGlobalEthTxFeeCapFlag = &cli.Float64Flag{ 846 Name: "rpc.ethtxfeecap", 847 Usage: "Sets a cap on transaction fee (=gasLimit*gasPrice) (in klay) in eth_signTransaction (0 = no cap)", 848 Aliases: []string{"http-rpc.eth-tx-feecap"}, 849 EnvVars: []string{"KLAYTN_RPC_ETHTXFEECAP"}, 850 Category: "API AND CONSOLE", 851 } 852 RPCConcurrencyLimit = &cli.IntFlag{ 853 Name: "rpc.concurrencylimit", 854 Usage: "Sets a limit of concurrent connection number of HTTP-RPC server", 855 Value: rpc.ConcurrencyLimit, 856 Aliases: []string{"http-rpc.concurrency-limit"}, 857 EnvVars: []string{"KLAYTN_RPC_CONCURRENCYLIMIT"}, 858 Category: "API AND CONSOLE", 859 } 860 RPCNonEthCompatibleFlag = &cli.BoolFlag{ 861 Name: "rpc.eth.noncompatible", 862 Usage: "Disables the eth namespace API return formatting for compatibility", 863 Aliases: []string{"http-rpc.eth-noncompatible"}, 864 EnvVars: []string{"KLAYTN_RPC_ETH_NONCOMPATIBLE"}, 865 Category: "API AND CONSOLE", 866 } 867 RPCReadTimeout = &cli.IntFlag{ 868 Name: "rpcreadtimeout", 869 Usage: "HTTP-RPC server read timeout (seconds)", 870 Value: int(rpc.DefaultHTTPTimeouts.ReadTimeout / time.Second), 871 Aliases: []string{"http-rpc.read-timeout"}, 872 EnvVars: []string{"KLAYTN_RPCREADTIMEOUT"}, 873 Category: "API AND CONSOLE", 874 } 875 RPCWriteTimeoutFlag = &cli.IntFlag{ 876 Name: "rpcwritetimeout", 877 Usage: "HTTP-RPC server write timeout (seconds)", 878 Value: int(rpc.DefaultHTTPTimeouts.WriteTimeout / time.Second), 879 Aliases: []string{"http-rpc.write-timeout"}, 880 EnvVars: []string{"KLAYTN_RPCWRITETIMEOUT"}, 881 Category: "API AND CONSOLE", 882 } 883 RPCIdleTimeoutFlag = &cli.IntFlag{ 884 Name: "rpcidletimeout", 885 Usage: "HTTP-RPC server idle timeout (seconds)", 886 Value: int(rpc.DefaultHTTPTimeouts.IdleTimeout / time.Second), 887 Aliases: []string{"http-rpc.idle-timeout"}, 888 EnvVars: []string{"KLAYTN_RPCIDLETIMEOUT"}, 889 Category: "API AND CONSOLE", 890 } 891 RPCExecutionTimeoutFlag = &cli.IntFlag{ 892 Name: "rpcexecutiontimeout", 893 Usage: "HTTP-RPC server execution timeout (seconds)", 894 Value: int(rpc.DefaultHTTPTimeouts.ExecutionTimeout / time.Second), 895 Aliases: []string{"http-rpc.execution-timeout"}, 896 EnvVars: []string{"KLAYTN_RPCEXECUTIONTIMEOUT"}, 897 Category: "API AND CONSOLE", 898 } 899 RPCUpstreamArchiveENFlag = &cli.StringFlag{ 900 Name: "upstream-en", 901 Usage: "upstream archive mode EN endpoint", 902 Aliases: []string{"rpc.upstream-en"}, 903 EnvVars: []string{"KLAYTN_RPC_UPSTREAM_EN"}, 904 Category: "API AND CONSOLE", 905 } 906 907 WSEnabledFlag = &cli.BoolFlag{ 908 Name: "ws", 909 Usage: "Enable the WS-RPC server", 910 Aliases: []string{"ws-rpc.enable"}, 911 EnvVars: []string{"KLAYTN_WS"}, 912 Category: "API AND CONSOLE", 913 } 914 WSListenAddrFlag = &cli.StringFlag{ 915 Name: "wsaddr", 916 Usage: "WS-RPC server listening interface", 917 Value: node.DefaultWSHost, 918 Aliases: []string{"ws-rpc.addr"}, 919 EnvVars: []string{"KLAYTN_WSADDR"}, 920 Category: "API AND CONSOLE", 921 } 922 WSPortFlag = &cli.IntFlag{ 923 Name: "wsport", 924 Usage: "WS-RPC server listening port", 925 Value: node.DefaultWSPort, 926 Aliases: []string{"ws-rpc.port"}, 927 EnvVars: []string{"KLAYTN_WSPORT"}, 928 Category: "API AND CONSOLE", 929 } 930 WSApiFlag = &cli.StringFlag{ 931 Name: "wsapi", 932 Usage: "API's offered over the WS-RPC interface", 933 Value: "", 934 Aliases: []string{"ws-rpc.api"}, 935 EnvVars: []string{"KLAYTN_WSAPI"}, 936 Category: "API AND CONSOLE", 937 } 938 WSAllowedOriginsFlag = &cli.StringFlag{ 939 Name: "wsorigins", 940 Usage: "Origins from which to accept websockets requests", 941 Value: "", 942 Aliases: []string{"ws-rpc.origins"}, 943 EnvVars: []string{"KLAYTN_WSORIGINS"}, 944 Category: "API AND CONSOLE", 945 } 946 WSMaxSubscriptionPerConn = &cli.IntFlag{ 947 Name: "wsmaxsubscriptionperconn", 948 Usage: "Allowed maximum subscription number per a websocket connection", 949 Value: int(rpc.MaxSubscriptionPerWSConn), 950 Aliases: []string{"ws-rpc.max-subscription-per-conn"}, 951 EnvVars: []string{"KLAYTN_WSMAXSUBSCRIPTIONPERCONN"}, 952 Category: "API AND CONSOLE", 953 } 954 WSReadDeadLine = &cli.Int64Flag{ 955 Name: "wsreaddeadline", 956 Usage: "Set the read deadline on the underlying network connection in seconds. 0 means read will not timeout", 957 Value: rpc.WebsocketReadDeadline, 958 Aliases: []string{"ws-rpc.read-deadline"}, 959 EnvVars: []string{"KLAYTN_WSREADDEADLINE"}, 960 Category: "API AND CONSOLE", 961 } 962 WSWriteDeadLine = &cli.Int64Flag{ 963 Name: "wswritedeadline", 964 Usage: "Set the Write deadline on the underlying network connection in seconds. 0 means write will not timeout", 965 Value: rpc.WebsocketWriteDeadline, 966 Aliases: []string{"ws-rpc.write-deadline"}, 967 EnvVars: []string{"KLAYTN_WSWRITEDEADLINE"}, 968 Category: "API AND CONSOLE", 969 } 970 WSMaxConnections = &cli.IntFlag{ 971 Name: "wsmaxconnections", 972 Usage: "Allowed maximum websocket connection number", 973 Value: 3000, 974 Aliases: []string{"ws-rpc.max-connections"}, 975 EnvVars: []string{"KLAYTN_WSMAXCONNECTIONS"}, 976 Category: "API AND CONSOLE", 977 } 978 GRPCEnabledFlag = &cli.BoolFlag{ 979 Name: "grpc", 980 Usage: "Enable the gRPC server", 981 Aliases: []string{"g-rpc.enable"}, 982 EnvVars: []string{"KLAYTN_GRPC"}, 983 Category: "API AND CONSOLE", 984 } 985 GRPCListenAddrFlag = &cli.StringFlag{ 986 Name: "grpcaddr", 987 Usage: "gRPC server listening interface", 988 Value: node.DefaultGRPCHost, 989 Aliases: []string{"g-rpc.addr"}, 990 EnvVars: []string{"KLAYTN_GRPCADDR"}, 991 Category: "API AND CONSOLE", 992 } 993 GRPCPortFlag = &cli.IntFlag{ 994 Name: "grpcport", 995 Usage: "gRPC server listening port", 996 Value: node.DefaultGRPCPort, 997 Aliases: []string{"g-rpc.port"}, 998 EnvVars: []string{"KLAYTN_GRPCPORT"}, 999 Category: "API AND CONSOLE", 1000 } 1001 IPCDisabledFlag = &cli.BoolFlag{ 1002 Name: "ipcdisable", 1003 Usage: "Disable the IPC-RPC server", 1004 Aliases: []string{"ipc.disable"}, 1005 EnvVars: []string{"KLAYTN_IPCDISABLE"}, 1006 Category: "API AND CONSOLE", 1007 } 1008 IPCPathFlag = &cli.PathFlag{ 1009 Name: "ipcpath", 1010 Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)", 1011 Aliases: []string{"ipc.path"}, 1012 EnvVars: []string{"KLAYTN_IPCPATH"}, 1013 Category: "API AND CONSOLE", 1014 } 1015 1016 // ATM the url is left to the user and deployment to 1017 JSpathFlag = &cli.StringFlag{ 1018 Name: "jspath", 1019 Usage: "JavaScript root path for `loadScript`", 1020 Value: ".", 1021 Aliases: []string{"console.js-path"}, 1022 EnvVars: []string{"KLAYTN_JSPATH"}, 1023 Category: "API AND CONSOLE", 1024 } 1025 ExecFlag = &cli.StringFlag{ 1026 Name: "exec", 1027 Usage: "Execute JavaScript statement", 1028 Aliases: []string{"console.exec"}, 1029 EnvVars: []string{"KLAYTN_EXEC"}, 1030 Category: "API AND CONSOLE", 1031 } 1032 PreloadJSFlag = &cli.StringFlag{ 1033 Name: "preload", 1034 Usage: "Comma separated list of JavaScript files to preload into the console", 1035 Aliases: []string{"console.preload"}, 1036 EnvVars: []string{"KLAYTN_PRELOAD"}, 1037 Category: "API AND CONSOLE", 1038 } 1039 APIFilterGetLogsDeadlineFlag = &cli.DurationFlag{ 1040 Name: "api.filter.getLogs.deadline", 1041 Usage: "Execution deadline for log collecting filter APIs", 1042 Value: filters.GetLogsDeadline, 1043 Aliases: []string{}, 1044 EnvVars: []string{"KLAYTN_API_FILTER_GETLOGS_DEADLINE"}, 1045 Category: "API AND CONSOLE", 1046 } 1047 APIFilterGetLogsMaxItemsFlag = &cli.IntFlag{ 1048 Name: "api.filter.getLogs.maxitems", 1049 Usage: "Maximum allowed number of return items for log collecting filter API", 1050 Value: filters.GetLogsMaxItems, 1051 Aliases: []string{}, 1052 EnvVars: []string{"KLAYTN_API_FILTER_GETLOGS_MAXITEMS"}, 1053 Category: "API AND CONSOLE", 1054 } 1055 UnsafeDebugDisableFlag = &cli.BoolFlag{ 1056 Name: "rpc.unsafe-debug.disable", 1057 Usage: "Disable unsafe debug APIs (traceTransaction, traceChain, ...).", 1058 Aliases: []string{"http-rpc.unsafe-debug.disable"}, 1059 EnvVars: []string{"KLAYTN_RPC_UNSAFE_DEBUG_DISABLE"}, 1060 Category: "API AND CONSOLE", 1061 } 1062 // TODO-klaytn: Consider limiting the non-debug heavy apis. 1063 HeavyDebugRequestLimitFlag = &cli.IntFlag{ 1064 Name: "rpc.unsafe-debug.heavy-debug.request-limit", 1065 Usage: "Limit the maximum number of heavy debug api requests. Works with unsafe-debug only.", 1066 Value: 50, 1067 Aliases: []string{}, 1068 EnvVars: []string{"KLAYTN_RPC_UNSAFE_DEBUG_HEAVY_DEBUG_REQUEST_LIMIT"}, 1069 Category: "API AND CONSOLE", 1070 } 1071 StateRegenerationTimeLimitFlag = &cli.DurationFlag{ 1072 Name: "rpc.unsafe-debug.state-regeneration.time-limit", 1073 Usage: "Limit the state regeneration time. Works with unsafe-debug only.", 1074 Value: 60 * time.Second, 1075 Aliases: []string{}, 1076 EnvVars: []string{"KLAYTN_RPC_UNSAFE_DEBUG_STATE_REGENERATION_TIME_LIMIT"}, 1077 Category: "API AND CONSOLE", 1078 } 1079 1080 // Network Settings 1081 NodeTypeFlag = &cli.StringFlag{ 1082 Name: "nodetype", 1083 Usage: "Klaytn node type (consensus node (cn), proxy node (pn), endpoint node (en))", 1084 Value: "en", 1085 Aliases: []string{}, 1086 EnvVars: []string{"KLAYTN_NODETYPE"}, 1087 } 1088 MaxConnectionsFlag = &cli.IntFlag{ 1089 Name: "maxconnections", 1090 Usage: "Maximum number of physical connections. All single channel peers can be maxconnections peers. All multi channel peers can be maxconnections/2 peers. (network disabled if set to 0)", 1091 Value: node.DefaultMaxPhysicalConnections, 1092 Aliases: []string{"p2p.max-connections"}, 1093 EnvVars: []string{"KLAYTN_MAXCONNECTIONS"}, 1094 Category: "NETWORK", 1095 } 1096 MaxPendingPeersFlag = &cli.IntFlag{ 1097 Name: "maxpendpeers", 1098 Usage: "Maximum number of pending connection attempts (defaults used if set to 0)", 1099 Value: 0, 1100 Aliases: []string{"p2p.max-pend-peers"}, 1101 EnvVars: []string{"KLAYTN_MAXPENDPEERS"}, 1102 Category: "NETWORK", 1103 } 1104 ListenPortFlag = &cli.IntFlag{ 1105 Name: "port", 1106 Usage: "Network listening port", 1107 Value: node.DefaultP2PPort, 1108 Aliases: []string{"p2p.port"}, 1109 EnvVars: []string{"KLAYTN_PORT"}, 1110 Category: "NETWORK", 1111 } 1112 SubListenPortFlag = &cli.IntFlag{ 1113 Name: "subport", 1114 Usage: "Network sub listening port", 1115 Value: node.DefaultP2PSubPort, 1116 Aliases: []string{"p2p.sub-port"}, 1117 EnvVars: []string{"KLAYTN_SUBPORT"}, 1118 Category: "NETWORK", 1119 } 1120 MultiChannelUseFlag = &cli.BoolFlag{ 1121 Name: "multichannel", 1122 Usage: "Create a dedicated channel for block propagation", 1123 Aliases: []string{"p2p.multi-channel"}, 1124 EnvVars: []string{"KLAYTN_MULTICHANNEL"}, 1125 Category: "NETWORK", 1126 } 1127 BootnodesFlag = &cli.StringFlag{ 1128 Name: "bootnodes", 1129 Usage: "Comma separated kni URLs for P2P discovery bootstrap", 1130 Value: "", 1131 Aliases: []string{"p2p.bootnodes"}, 1132 EnvVars: []string{"KLAYTN_BOOTNODES"}, 1133 Category: "NETWORK", 1134 } 1135 NodeKeyFileFlag = &cli.StringFlag{ 1136 Name: "nodekey", 1137 Usage: "P2P node key file", 1138 Aliases: []string{"p2p.node-key"}, 1139 EnvVars: []string{"KLAYTN_NODEKEY"}, 1140 Category: "NETWORK", 1141 } 1142 NodeKeyHexFlag = &cli.StringFlag{ 1143 Name: "nodekeyhex", 1144 Usage: "P2P node key as hex (for testing)", 1145 Aliases: []string{"p2p.node-key-hex"}, 1146 EnvVars: []string{"KLAYTN_NODEKEYHEX"}, 1147 Category: "NETWORK", 1148 } 1149 BlsNodeKeyFileFlag = &cli.StringFlag{ 1150 Name: "bls-nodekey", 1151 Usage: "Consensus BLS node key file", 1152 Aliases: []string{"p2p.bls-node-key"}, 1153 EnvVars: []string{"KLAYTN_BLS_NODEKEY"}, 1154 Category: "NETWORK", 1155 } 1156 BlsNodeKeyHexFlag = &cli.StringFlag{ 1157 Name: "bls-nodekeyhex", 1158 Usage: "Consensus BLS node key in hex (for testing)", 1159 Aliases: []string{"p2p.bls-node-key-hex"}, 1160 EnvVars: []string{"KLAYTN_BLS_NODEKEYHEX"}, 1161 Category: "NETWORK", 1162 } 1163 BlsNodeKeystoreFileFlag = &cli.StringFlag{ 1164 Name: "bls-nodekeystore", 1165 Usage: "Consensus BLS node keystore JSON file (to be imported)", 1166 Aliases: []string{"p2p.bls-node-keystore"}, 1167 EnvVars: []string{"KLAYTN_BLS_NODEKEYSTORE"}, 1168 Category: "NETWORK", 1169 } 1170 NATFlag = &cli.StringFlag{ 1171 Name: "nat", 1172 Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)", 1173 Value: "any", 1174 Aliases: []string{"p2p.nat"}, 1175 EnvVars: []string{"KLAYTN_NAT"}, 1176 Category: "NETWORK", 1177 } 1178 NoDiscoverFlag = &cli.BoolFlag{ 1179 Name: "nodiscover", 1180 Usage: "Disables the peer discovery mechanism (manual peer addition)", 1181 Aliases: []string{"p2p.no-discover"}, 1182 EnvVars: []string{"KLAYTN_NODISCOVER"}, 1183 Category: "NETWORK", 1184 } 1185 NetrestrictFlag = &cli.StringFlag{ 1186 Name: "netrestrict", 1187 Usage: "Restricts network communication to the given IP network (CIDR masks)", 1188 Aliases: []string{"p2p.net-restrict"}, 1189 EnvVars: []string{"KLAYTN_NETRESTRICT"}, 1190 Category: "NETWORK", 1191 } 1192 RWTimerIntervalFlag = &cli.Uint64Flag{ 1193 Name: "rwtimerinterval", 1194 Usage: "Interval of using rw timer to check if it works well", 1195 Value: 1000, 1196 Aliases: []string{"p2p.rw-timer-interval"}, 1197 EnvVars: []string{"KLAYTN_RWTIMERINTERVAL"}, 1198 Category: "NETWORK", 1199 } 1200 RWTimerWaitTimeFlag = &cli.DurationFlag{ 1201 Name: "rwtimerwaittime", 1202 Usage: "Wait time the rw timer waits for message writing", 1203 Value: 15 * time.Second, 1204 Aliases: []string{"p2p.rw-timer-wait-time"}, 1205 EnvVars: []string{"KLAYTN_RWTIMERWAITTIME"}, 1206 Category: "NETWORK", 1207 } 1208 MaxRequestContentLengthFlag = &cli.IntFlag{ 1209 Name: "maxRequestContentLength", 1210 Usage: "Max request content length in byte for http, websocket and gRPC", 1211 Value: common.MaxRequestContentLength, 1212 Aliases: []string{"p2p.max-request-content-length"}, 1213 EnvVars: []string{"KLAYTN_MAXREQUESTCONTENTLENGTH"}, 1214 Category: "API AND CONSOLE", 1215 } 1216 1217 CypressFlag = &cli.BoolFlag{ 1218 Name: "cypress", 1219 Usage: "Pre-configured Klaytn Cypress network", 1220 Aliases: []string{"p2p.cypress"}, 1221 EnvVars: []string{"KLAYTN_CYPRESS"}, 1222 Category: "NETWORK", 1223 } 1224 // Baobab bootnodes setting 1225 BaobabFlag = &cli.BoolFlag{ 1226 Name: "baobab", 1227 Usage: "Pre-configured Klaytn baobab network", 1228 Aliases: []string{"p2p.baobab"}, 1229 EnvVars: []string{"KLAYTN_BAOBAB"}, 1230 Category: "NETWORK", 1231 } 1232 // Bootnode's settings 1233 AuthorizedNodesFlag = &cli.StringFlag{ 1234 Name: "authorized-nodes", 1235 Usage: "Comma separated kni URLs for authorized nodes list", 1236 Value: "", 1237 Aliases: []string{"common.authorized-nodes"}, 1238 EnvVars: []string{"KLAYTN_AUTHORIZED_NODES"}, 1239 } 1240 // TODO-Klaytn-Bootnode the boodnode flags should be updated when it is implemented 1241 BNAddrFlag = &cli.StringFlag{ 1242 Name: "bnaddr", 1243 Usage: `udp address to use node discovery`, 1244 Value: ":32323", 1245 Aliases: []string{"p2p.bn-addr"}, 1246 EnvVars: []string{"KLAYTN_BNADDR"}, 1247 } 1248 GenKeyFlag = &cli.StringFlag{ 1249 Name: "genkey", 1250 Usage: "generate a node private key and write to given filename", 1251 Aliases: []string{"common.gen-key-path"}, 1252 EnvVars: []string{"KLAYTN_GENKEY"}, 1253 Category: "MISC", 1254 } 1255 WriteAddressFlag = &cli.BoolFlag{ 1256 Name: "writeaddress", 1257 Usage: `write out the node's public key which is given by "--nodekey" or "--nodekeyhex"`, 1258 Aliases: []string{"common.write-address"}, 1259 EnvVars: []string{"KLAYTN_WRITEADDRESS"}, 1260 Category: "MISC", 1261 } 1262 // ServiceChain's settings 1263 AnchoringPeriodFlag = &cli.Uint64Flag{ 1264 Name: "chaintxperiod", 1265 Usage: "The period to make and send a chain transaction to the parent chain", 1266 Value: 1, 1267 Aliases: []string{"servicechain.chain-tx-period"}, 1268 EnvVars: []string{"KLAYTN_CHAINTXPERIOD"}, 1269 Category: "SERVICECHAIN", 1270 } 1271 SentChainTxsLimit = &cli.Uint64Flag{ 1272 Name: "chaintxlimit", 1273 Usage: "Number of service chain transactions stored for resending", 1274 Value: 100, 1275 Aliases: []string{"servicechain.chain-tx-limit"}, 1276 EnvVars: []string{"KLAYTN_CHAINTXLIMIT"}, 1277 Category: "SERVICECHAIN", 1278 } 1279 MainBridgeFlag = &cli.BoolFlag{ 1280 Name: "mainbridge", 1281 Usage: "Enable main bridge service for service chain", 1282 Aliases: []string{"servicechain.mainbridge"}, 1283 EnvVars: []string{"KLAYTN_MAINBRIDGE"}, 1284 Category: "SERVICECHAIN", 1285 } 1286 SubBridgeFlag = &cli.BoolFlag{ 1287 Name: "subbridge", 1288 Usage: "Enable sub bridge service for service chain", 1289 Aliases: []string{"servicechain.subbridge"}, 1290 EnvVars: []string{"KLAYTN_SUBBRIDGE"}, 1291 Category: "SERVICECHAIN", 1292 } 1293 MainBridgeListenPortFlag = &cli.IntFlag{ 1294 Name: "mainbridgeport", 1295 Usage: "main bridge listen port", 1296 Value: 50505, 1297 Aliases: []string{"servicechain.mainbridge-port"}, 1298 EnvVars: []string{"KLAYTN_MAINBRIDGEPORT"}, 1299 Category: "SERVICECHAIN", 1300 } 1301 SubBridgeListenPortFlag = &cli.IntFlag{ 1302 Name: "subbridgeport", 1303 Usage: "sub bridge listen port", 1304 Value: 50506, 1305 Aliases: []string{"servicechain.subbridge-port"}, 1306 EnvVars: []string{"KLAYTN_SUBBRIDGEPORT"}, 1307 Category: "SERVICECHAIN", 1308 } 1309 ParentChainIDFlag = &cli.IntFlag{ 1310 Name: "parentchainid", 1311 Usage: "parent chain ID", 1312 Value: 8217, // Klaytn mainnet chain ID 1313 Aliases: []string{"servicechain.parent-chainid"}, 1314 EnvVars: []string{"KLAYTN_PARENTCHAINID"}, 1315 Category: "SERVICECHAIN", 1316 } 1317 VTRecoveryFlag = &cli.BoolFlag{ 1318 Name: "vtrecovery", 1319 Usage: "Enable value transfer recovery (default: false)", 1320 Aliases: []string{"servicechain.vt-recovery"}, 1321 EnvVars: []string{"KLAYTN_VTRECOVERY"}, 1322 Category: "SERVICECHAIN", 1323 } 1324 VTRecoveryIntervalFlag = &cli.Uint64Flag{ 1325 Name: "vtrecoveryinterval", 1326 Usage: "Set the value transfer recovery interval (seconds)", 1327 Value: 5, 1328 Aliases: []string{"servicechain.vt-recovery-interval"}, 1329 EnvVars: []string{"KLAYTN_VTRECOVERYINTERVAL"}, 1330 Category: "SERVICECHAIN", 1331 } 1332 ServiceChainParentOperatorTxGasLimitFlag = &cli.Uint64Flag{ 1333 Name: "sc.parentoperator.gaslimit", 1334 Usage: "Set the default value of gas limit for transactions made by bridge parent operator", 1335 Value: 10000000, 1336 Aliases: []string{"servicechain.parent-operator-gaslimit"}, 1337 EnvVars: []string{"KLAYTN_SC_PARENTOPERATOR_GASLIMIT"}, 1338 Category: "SERVICECHAIN", 1339 } 1340 ServiceChainChildOperatorTxGasLimitFlag = &cli.Uint64Flag{ 1341 Name: "sc.childoperator.gaslimit", 1342 Usage: "Set the default value of gas limit for transactions made by bridge child operator", 1343 Value: 10000000, 1344 Aliases: []string{"servicechain.child-operator-gaslimit"}, 1345 EnvVars: []string{"KLAYTN_SC_CHILDOPERATOR_GASLIMIT"}, 1346 Category: "SERVICECHAIN", 1347 } 1348 ServiceChainNewAccountFlag = &cli.BoolFlag{ 1349 Name: "scnewaccount", 1350 Usage: "Enable account creation for the service chain (default: false). If set true, generated account can't be synced with the parent chain.", 1351 Aliases: []string{"servicechain.new-account"}, 1352 EnvVars: []string{"KLAYTN_SCNEWACCOUNT"}, 1353 Category: "SERVICECHAIN", 1354 } 1355 ServiceChainAnchoringFlag = &cli.BoolFlag{ 1356 Name: "anchoring", 1357 Usage: "Enable anchoring for service chain", 1358 Aliases: []string{"servicechain.anchoring"}, 1359 EnvVars: []string{"KLAYTN_ANCHORING"}, 1360 Category: "SERVICECHAIN", 1361 } 1362 // TODO-klaytn: need to check if deprecated. 1363 ServiceChainConsensusFlag = &cli.StringFlag{ 1364 Name: "scconsensus", 1365 Usage: "Set the service chain consensus (\"istanbul\", \"clique\")", 1366 Value: "istanbul", 1367 Aliases: []string{"servicechain.consensus"}, 1368 EnvVars: []string{"KLAYTN_SCCONSENSUS"}, 1369 } 1370 1371 // KAS 1372 KASServiceChainAnchorFlag = &cli.BoolFlag{ 1373 Name: "kas.sc.anchor", 1374 Usage: "Enable KAS anchoring for service chain", 1375 Aliases: []string{}, 1376 EnvVars: []string{"KLAYTN_KAS_SC_ANCHOR"}, 1377 Category: "SERVICECHAIN", 1378 } 1379 KASServiceChainAnchorPeriodFlag = &cli.Uint64Flag{ 1380 Name: "kas.sc.anchor.period", 1381 Usage: "The period to anchor service chain blocks to KAS", 1382 Value: 1, 1383 Aliases: []string{}, 1384 EnvVars: []string{"KLAYTN_KAS_SC_ANCHOR_PERIOD"}, 1385 Category: "SERVICECHAIN", 1386 } 1387 KASServiceChainAnchorUrlFlag = &cli.StringFlag{ 1388 Name: "kas.sc.anchor.url", 1389 Usage: "The url for KAS anchor", 1390 Aliases: []string{}, 1391 EnvVars: []string{"KLAYTN_KAS_SC_ANCHOR_URL"}, 1392 Category: "SERVICECHAIN", 1393 } 1394 KASServiceChainAnchorOperatorFlag = &cli.StringFlag{ 1395 Name: "kas.sc.anchor.operator", 1396 Usage: "The operator address for KAS anchor", 1397 Aliases: []string{}, 1398 EnvVars: []string{"KLAYTN_KAS_SC_ANCHOR_OPERATOR"}, 1399 Category: "SERVICECHAIN", 1400 } 1401 KASServiceChainAnchorRequestTimeoutFlag = &cli.DurationFlag{ 1402 Name: "kas.sc.anchor.request.timeout", 1403 Usage: "The reuqest timeout for KAS Anchoring API call", 1404 Value: 500 * time.Millisecond, 1405 Aliases: []string{}, 1406 EnvVars: []string{"KLAYTN_KAS_SC_ANCHOR_REQUEST_TIMEOUT"}, 1407 Category: "SERVICECHAIN", 1408 } 1409 KASServiceChainXChainIdFlag = &cli.StringFlag{ 1410 Name: "kas.x-chain-id", 1411 Usage: "The x-chain-id for KAS", 1412 Aliases: []string{}, 1413 EnvVars: []string{"KLAYTN_KAS_X_CHAIN_ID"}, 1414 Category: "SERVICECHAIN", 1415 } 1416 KASServiceChainAccessKeyFlag = &cli.StringFlag{ 1417 Name: "kas.accesskey", 1418 Usage: "The access key id for KAS", 1419 Aliases: []string{}, 1420 EnvVars: []string{"KLAYTN_KAS_ACCESSKEY"}, 1421 Category: "SERVICECHAIN", 1422 } 1423 KASServiceChainSecretKeyFlag = &cli.StringFlag{ 1424 Name: "kas.secretkey", 1425 Usage: "The secret key for KAS", 1426 Aliases: []string{}, 1427 EnvVars: []string{"KLAYTN_KAS_SECRETKEY"}, 1428 Category: "SERVICECHAIN", 1429 } 1430 1431 // ChainDataFetcher 1432 EnableChainDataFetcherFlag = &cli.BoolFlag{ 1433 Name: "chaindatafetcher", 1434 Usage: "Enable the ChainDataFetcher Service", 1435 Aliases: []string{"chain-data-fetcher.enable"}, 1436 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER"}, 1437 Category: "CHAINDATAFETCHER", 1438 } 1439 ChainDataFetcherMode = &cli.StringFlag{ 1440 Name: "chaindatafetcher.mode", 1441 Usage: "The mode of chaindatafetcher (\"kas\", \"kafka\")", 1442 Value: "kas", 1443 Aliases: []string{"chain-data-fetcher.mode"}, 1444 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_MODE"}, 1445 Category: "CHAINDATAFETCHER", 1446 } 1447 ChainDataFetcherNoDefault = &cli.BoolFlag{ 1448 Name: "chaindatafetcher.no.default", 1449 Usage: "Turn off the starting of the chaindatafetcher", 1450 Aliases: []string{"chain-data-fetcher.no-default"}, 1451 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_NO_DEFAULT"}, 1452 Category: "CHAINDATAFETCHER", 1453 } 1454 ChainDataFetcherNumHandlers = &cli.IntFlag{ 1455 Name: "chaindatafetcher.num.handlers", 1456 Usage: "Number of chaindata handlers", 1457 Value: chaindatafetcher.DefaultNumHandlers, 1458 Aliases: []string{"chain-data-fetcher.num-handlers"}, 1459 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_NUM_HANDLERS"}, 1460 Category: "CHAINDATAFETCHER", 1461 } 1462 ChainDataFetcherJobChannelSize = &cli.IntFlag{ 1463 Name: "chaindatafetcher.job.channel.size", 1464 Usage: "Job channel size", 1465 Value: chaindatafetcher.DefaultJobChannelSize, 1466 Aliases: []string{"chain-data-fetcher.job-channel-size"}, 1467 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_JOB_CHANNEL_SIZE"}, 1468 Category: "CHAINDATAFETCHER", 1469 } 1470 ChainDataFetcherChainEventSizeFlag = &cli.IntFlag{ 1471 Name: "chaindatafetcher.block.channel.size", 1472 Usage: "Block received channel size", 1473 Value: chaindatafetcher.DefaultJobChannelSize, 1474 Aliases: []string{"chain-data-fetcher.block-channel-size"}, 1475 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_BLOCK_CHANNEL_SIZE"}, 1476 Category: "CHAINDATAFETCHER", 1477 } 1478 ChainDataFetcherMaxProcessingDataSize = &cli.IntFlag{ 1479 Name: "chaindatafetcher.max.processing.data.size", 1480 Usage: "Maximum size of processing data before requesting range fetching of blocks (in MB)", 1481 Value: chaindatafetcher.DefaultMaxProcessingDataSize, 1482 Aliases: []string{"chain-data-fetcher.max-processing-data-size"}, 1483 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_MAX_PROCESSING_DATA_SIZE"}, 1484 Category: "CHAINDATAFETCHER", 1485 } 1486 ChainDataFetcherKASDBHostFlag = &cli.StringFlag{ 1487 Name: "chaindatafetcher.kas.db.host", 1488 Usage: "KAS specific DB host in chaindatafetcher", 1489 Aliases: []string{"chain-data-fetcher.kas.db.host"}, 1490 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_DB_HOST"}, 1491 Category: "CHAINDATAFETCHER", 1492 } 1493 ChainDataFetcherKASDBPortFlag = &cli.StringFlag{ 1494 Name: "chaindatafetcher.kas.db.port", 1495 Usage: "KAS specific DB port in chaindatafetcher", 1496 Value: chaindatafetcher.DefaultDBPort, 1497 Aliases: []string{"chain-data-fetcher.kas.db.port"}, 1498 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_DB_PORT"}, 1499 Category: "CHAINDATAFETCHER", 1500 } 1501 ChainDataFetcherKASDBNameFlag = &cli.StringFlag{ 1502 Name: "chaindatafetcher.kas.db.name", 1503 Usage: "KAS specific DB name in chaindatafetcher", 1504 Aliases: []string{"chain-data-fetcher.kas.db.name"}, 1505 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_DB_NAME"}, 1506 Category: "CHAINDATAFETCHER", 1507 } 1508 ChainDataFetcherKASDBUserFlag = &cli.StringFlag{ 1509 Name: "chaindatafetcher.kas.db.user", 1510 Usage: "KAS specific DB user in chaindatafetcher", 1511 Aliases: []string{"chain-data-fetcher.kas.db.user"}, 1512 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_DB_USER"}, 1513 Category: "CHAINDATAFETCHER", 1514 } 1515 ChainDataFetcherKASDBPasswordFlag = &cli.StringFlag{ 1516 Name: "chaindatafetcher.kas.db.password", 1517 Usage: "KAS specific DB password in chaindatafetcher", 1518 Aliases: []string{"chain-data-fetcher.kas.db.password"}, 1519 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_DB_PASSWORD"}, 1520 Category: "CHAINDATAFETCHER", 1521 } 1522 ChainDataFetcherKASCacheUse = &cli.BoolFlag{ 1523 Name: "chaindatafetcher.kas.cache.use", 1524 Usage: "Enable KAS cache invalidation", 1525 Aliases: []string{"chain-data-fetcher.kas.cache.use"}, 1526 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_CACHE_USE"}, 1527 Category: "CHAINDATAFETCHER", 1528 } 1529 ChainDataFetcherKASCacheURLFlag = &cli.StringFlag{ 1530 Name: "chaindatafetcher.kas.cache.url", 1531 Usage: "KAS specific cache invalidate API endpoint in chaindatafetcher", 1532 Aliases: []string{"chain-data-fetcher.kas.cache.url"}, 1533 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_CACHE_URL"}, 1534 Category: "CHAINDATAFETCHER", 1535 } 1536 ChainDataFetcherKASXChainIdFlag = &cli.StringFlag{ 1537 Name: "chaindatafetcher.kas.xchainid", 1538 Usage: "KAS specific header x-chain-id in chaindatafetcher", 1539 Aliases: []string{"chain-data-fetcher.kas.xchainid"}, 1540 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_XCHAINID"}, 1541 Category: "CHAINDATAFETCHER", 1542 } 1543 ChainDataFetcherKASBasicAuthParamFlag = &cli.StringFlag{ 1544 Name: "chaindatafetcher.kas.basic.auth.param", 1545 Usage: "KAS specific header basic authorization parameter in chaindatafetcher", 1546 Aliases: []string{"chain-data-fetcher.kas.basic.auth.param"}, 1547 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAS_BASIC_AUTH_PARAM"}, 1548 Category: "CHAINDATAFETCHER", 1549 } 1550 ChainDataFetcherKafkaBrokersFlag = &cli.StringSliceFlag{ 1551 Name: "chaindatafetcher.kafka.brokers", 1552 Usage: "Kafka broker URL list", 1553 Aliases: []string{"chain-data-fetcher.kafka.brokers"}, 1554 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_BROKERS"}, 1555 Category: "CHAINDATAFETCHER", 1556 } 1557 ChainDataFetcherKafkaTopicEnvironmentFlag = &cli.StringFlag{ 1558 Name: "chaindatafetcher.kafka.topic.environment", 1559 Usage: "Kafka topic environment prefix", 1560 Value: kafka.DefaultTopicEnvironmentName, 1561 Aliases: []string{"chain-data-fetcher.kafka.topic.environment"}, 1562 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_TOPIC_ENVIRONMENT"}, 1563 Category: "CHAINDATAFETCHER", 1564 } 1565 ChainDataFetcherKafkaTopicResourceFlag = &cli.StringFlag{ 1566 Name: "chaindatafetcher.kafka.topic.resource", 1567 Usage: "Kafka topic resource name", 1568 Value: kafka.DefaultTopicResourceName, 1569 Aliases: []string{"chain-data-fetcher.kafka.topic.resource"}, 1570 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_TOPIC_RESOURCE"}, 1571 Category: "CHAINDATAFETCHER", 1572 } 1573 ChainDataFetcherKafkaReplicasFlag = &cli.Int64Flag{ 1574 Name: "chaindatafetcher.kafka.replicas", 1575 Usage: "Kafka partition replication factor", 1576 Value: kafka.DefaultReplicas, 1577 Aliases: []string{"chain-data-fetcher.kafka.replicas"}, 1578 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_REPLICAS"}, 1579 Category: "CHAINDATAFETCHER", 1580 } 1581 ChainDataFetcherKafkaPartitionsFlag = &cli.IntFlag{ 1582 Name: "chaindatafetcher.kafka.partitions", 1583 Usage: "The number of partitions in a topic", 1584 Value: kafka.DefaultPartitions, 1585 Aliases: []string{"chain-data-fetcher.kafka.partitions"}, 1586 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_PARTITIONS"}, 1587 Category: "CHAINDATAFETCHER", 1588 } 1589 ChainDataFetcherKafkaMaxMessageBytesFlag = &cli.IntFlag{ 1590 Name: "chaindatafetcher.kafka.max.message.bytes", 1591 Usage: "The max size of a message produced by Kafka producer ", 1592 Value: kafka.DefaultMaxMessageBytes, 1593 Aliases: []string{"chain-data-fetcher.kafka.max-message-bytes"}, 1594 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_MAX_MESSAGE_BYTES"}, 1595 Category: "CHAINDATAFETCHER", 1596 } 1597 ChainDataFetcherKafkaSegmentSizeBytesFlag = &cli.IntFlag{ 1598 Name: "chaindatafetcher.kafka.segment.size", 1599 Usage: "The kafka data segment size (in byte)", 1600 Value: kafka.DefaultSegmentSizeBytes, 1601 Aliases: []string{"chain-data-fetcher.kafka.segment-size"}, 1602 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_SEGMENT_SIZE"}, 1603 Category: "CHAINDATAFETCHER", 1604 } 1605 ChainDataFetcherKafkaRequiredAcksFlag = &cli.IntFlag{ 1606 Name: "chaindatafetcher.kafka.required.acks", 1607 Usage: "The level of acknowledgement reliability needed from Kafka broker (0: NoResponse, 1: WaitForLocal, -1: WaitForAll)", 1608 Value: kafka.DefaultRequiredAcks, 1609 Aliases: []string{"chain-data-fetcher.kafka.required-acks"}, 1610 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_REQUIRED_ACKS"}, 1611 Category: "CHAINDATAFETCHER", 1612 } 1613 ChainDataFetcherKafkaMessageVersionFlag = &cli.StringFlag{ 1614 Name: "chaindatafetcher.kafka.msg.version", 1615 Usage: "The version of Kafka message", 1616 Value: kafka.DefaultKafkaMessageVersion, 1617 Aliases: []string{"chain-data-fetcher.kafka.msg-version"}, 1618 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_MSG_VERSION"}, 1619 Category: "CHAINDATAFETCHER", 1620 } 1621 ChainDataFetcherKafkaProducerIdFlag = &cli.StringFlag{ 1622 Name: "chaindatafetcher.kafka.producer.id", 1623 Usage: "The identifier of kafka message producer", 1624 Value: kafka.GetDefaultProducerId(), 1625 Aliases: []string{"chain-data-fetcher.kafka.producer-id"}, 1626 EnvVars: []string{"KLAYTN_CHAINDATAFETCHER_KAFKA_PRODUCER_ID"}, 1627 Category: "CHAINDATAFETCHER", 1628 } 1629 // DBSyncer 1630 EnableDBSyncerFlag = &cli.BoolFlag{ 1631 Name: "dbsyncer", 1632 Usage: "Enable the DBSyncer", 1633 Aliases: []string{"db-syncer.enable"}, 1634 EnvVars: []string{"KLAYTN_DBSYNCER"}, 1635 Category: "DATABASE SYNCER", 1636 } 1637 DBHostFlag = &cli.StringFlag{ 1638 Name: "dbsyncer.db.host", 1639 Usage: "db.host in dbsyncer", 1640 Aliases: []string{"db-syncer.db.host"}, 1641 EnvVars: []string{"KLAYTN_DBSYNCER_DB_HOST"}, 1642 Category: "DATABASE SYNCER", 1643 } 1644 DBPortFlag = &cli.StringFlag{ 1645 Name: "dbsyncer.db.port", 1646 Usage: "db.port in dbsyncer", 1647 Value: "3306", 1648 Aliases: []string{"db-syncer.db.port"}, 1649 EnvVars: []string{"KLAYTN_DBSYNCER_DB_PORT"}, 1650 Category: "DATABASE SYNCER", 1651 } 1652 DBNameFlag = &cli.StringFlag{ 1653 Name: "dbsyncer.db.name", 1654 Usage: "db.name in dbsyncer", 1655 Aliases: []string{"db-syncer.db.name"}, 1656 EnvVars: []string{"KLAYTN_DBSYNCER_DB_NAME"}, 1657 Category: "DATABASE SYNCER", 1658 } 1659 DBUserFlag = &cli.StringFlag{ 1660 Name: "dbsyncer.db.user", 1661 Usage: "db.user in dbsyncer", 1662 Aliases: []string{"db-syncer.db.user"}, 1663 EnvVars: []string{"KLAYTN_DBSYNCER_DB_USER"}, 1664 Category: "DATABASE SYNCER", 1665 } 1666 DBPasswordFlag = &cli.StringFlag{ 1667 Name: "dbsyncer.db.password", 1668 Usage: "db.password in dbsyncer", 1669 Aliases: []string{"db-syncer.db.password"}, 1670 EnvVars: []string{"KLAYTN_DBSYNCER_DB_PASSWORD"}, 1671 Category: "DATABASE SYNCER", 1672 } 1673 EnabledLogModeFlag = &cli.BoolFlag{ 1674 Name: "dbsyncer.logmode", 1675 Usage: "Enable the dbsyncer logmode", 1676 Aliases: []string{"db-syncer.log-mode"}, 1677 EnvVars: []string{"KLAYTN_DBSYNCER_LOGMODE"}, 1678 Category: "DATABASE SYNCER", 1679 } 1680 MaxIdleConnsFlag = &cli.IntFlag{ 1681 Name: "dbsyncer.db.max.idle", 1682 Usage: "The maximum number of connections in the idle connection pool", 1683 Value: 50, 1684 Aliases: []string{"db-syncer.db.max-idle"}, 1685 EnvVars: []string{"KLAYTN_DBSYNCER_DB_MAX_IDLE"}, 1686 Category: "DATABASE SYNCER", 1687 } 1688 MaxOpenConnsFlag = &cli.IntFlag{ 1689 Name: "dbsyncer.db.max.open", 1690 Usage: "The maximum number of open connections to the database", 1691 Value: 30, 1692 Aliases: []string{"db-syncer.db.max-open"}, 1693 EnvVars: []string{"KLAYTN_DBSYNCER_DB_MAX_OPEN"}, 1694 Category: "DATABASE SYNCER", 1695 } 1696 ConnMaxLifeTimeFlag = &cli.DurationFlag{ 1697 Name: "dbsyncer.db.max.lifetime", 1698 Usage: "The maximum amount of time a connection may be reused (default : 1h), ex: 300ms, 2h45m, 60s, ...", 1699 Value: 1 * time.Hour, 1700 Aliases: []string{"db-syncer.db.max-lifetime"}, 1701 EnvVars: []string{"KLAYTN_DBSYNCER_DB_MAX_LIFETIME"}, 1702 Category: "DATABASE SYNCER", 1703 } 1704 BlockSyncChannelSizeFlag = &cli.IntFlag{ 1705 Name: "dbsyncer.block.channel.size", 1706 Usage: "Block received channel size", 1707 Value: 5, 1708 Aliases: []string{"db-syncer.block-channel-size"}, 1709 EnvVars: []string{"KLAYTN_DBSYNCER_BLOCK_CHANNEL_SIZE"}, 1710 Category: "DATABASE SYNCER", 1711 } 1712 DBSyncerModeFlag = &cli.StringFlag{ 1713 Name: "dbsyncer.mode", 1714 Usage: "The mode of dbsyncer is way which handle block/tx data to insert db (multi, single, context)", 1715 Value: "multi", 1716 Aliases: []string{"db-syncer.mode"}, 1717 EnvVars: []string{"KLAYTN_DBSYNCER_MODE"}, 1718 Category: "DATABASE SYNCER", 1719 } 1720 GenQueryThreadFlag = &cli.IntFlag{ 1721 Name: "dbsyncer.genquery.th", 1722 Usage: "The amount of thread of generation query in multi mode", 1723 Value: 50, 1724 Aliases: []string{"db-syncer.genquery-th"}, 1725 EnvVars: []string{"KLAYTN_DBSYNCER_GENQUERY_TH"}, 1726 Category: "DATABASE SYNCER", 1727 } 1728 InsertThreadFlag = &cli.IntFlag{ 1729 Name: "dbsyncer.insert.th", 1730 Usage: "The amount of thread of insert operation in multi mode", 1731 Value: 30, 1732 Aliases: []string{"db-syncer.insert-thread"}, 1733 EnvVars: []string{"KLAYTN_DBSYNCER_INSERT_TH"}, 1734 Category: "DATABASE SYNCER", 1735 } 1736 BulkInsertSizeFlag = &cli.IntFlag{ 1737 Name: "dbsyncer.bulk.size", 1738 Usage: "The amount of row for bulk-insert", 1739 Value: 200, 1740 Aliases: []string{"db-syncer.bulk-size"}, 1741 EnvVars: []string{"KLAYTN_DBSYNCER_BULK_SIZE"}, 1742 Category: "DATABASE SYNCER", 1743 } 1744 EventModeFlag = &cli.StringFlag{ 1745 Name: "dbsyncer.event.mode", 1746 Usage: "The way how to sync all block or last block (block, head)", 1747 Value: "head", 1748 Aliases: []string{"db-syncer.event-mode"}, 1749 EnvVars: []string{"KLAYTN_DBSYNCER_EVENT_MODE"}, 1750 Category: "DATABASE SYNCER", 1751 } 1752 MaxBlockDiffFlag = &cli.Uint64Flag{ 1753 Name: "dbsyncer.max.block.diff", 1754 Usage: "The maximum difference between current block and event block. 0 means off", 1755 Value: 0, 1756 Aliases: []string{"db-syncer.max-block-diff"}, 1757 EnvVars: []string{"KLAYTN_DBSYNCER_MAX_BLOCK_DIFF"}, 1758 Category: "DATABASE SYNCER", 1759 } 1760 AutoRestartFlag = &cli.BoolFlag{ 1761 Name: "autorestart.enable", 1762 Usage: "Node can restart itself when there is a problem in making consensus", 1763 Aliases: []string{}, 1764 EnvVars: []string{"KLAYTN_AUTORESTART_ENABLE"}, 1765 Category: "MISC", 1766 } 1767 RestartTimeOutFlag = &cli.DurationFlag{ 1768 Name: "autorestart.timeout", 1769 Usage: "The elapsed time to wait auto restart (minutes)", 1770 Value: 15 * time.Minute, 1771 Aliases: []string{}, 1772 EnvVars: []string{"KLAYTN_AUTORESTART_TIMEOUT"}, 1773 Category: "MISC", 1774 } 1775 DaemonPathFlag = &cli.StringFlag{ 1776 Name: "autorestart.daemon.path", 1777 Usage: "Path of node daemon. Used to give signal to kill", 1778 Value: "~/klaytn/bin/kcnd", 1779 Aliases: []string{"autorestart.daemon-path"}, 1780 EnvVars: []string{"KLAYTN_AUTORESTART_DAEMON_PATH"}, 1781 Category: "MISC", 1782 } 1783 1784 // db migration vars 1785 DstDbTypeFlag = &cli.StringFlag{ 1786 Name: "dst.dbtype", 1787 Usage: `Blockchain storage database type ("LevelDB", "BadgerDB", "DynamoDBS3")`, 1788 Value: "LevelDB", 1789 Aliases: []string{"migration.dst.dbtype"}, 1790 EnvVars: []string{"KLAYTN_DST_DBTYPE"}, 1791 Category: "DATABASE MIGRATION", 1792 } 1793 DstDataDirFlag = &cli.PathFlag{ 1794 Name: "dst.datadir", 1795 Usage: "Data directory for the databases and keystore. This value is only used in local DB.", 1796 Aliases: []string{"migration.dst.datadir"}, 1797 EnvVars: []string{"KLAYTN_DST_DATADIR"}, 1798 Category: "DATABASE MIGRATION", 1799 } 1800 DstSingleDBFlag = &cli.BoolFlag{ 1801 Name: "db.dst.single", 1802 Usage: "Create a single persistent storage. MiscDB, headerDB and etc are stored in one DB.", 1803 Aliases: []string{"migration.dst.single"}, 1804 EnvVars: []string{"KLAYTN_DB_DST_SINGLE"}, 1805 Category: "DATABASE MIGRATION", 1806 } 1807 DstLevelDBCacheSizeFlag = &cli.IntFlag{ 1808 Name: "db.dst.leveldb.cache-size", 1809 Usage: "Size of in-memory cache in LevelDB (MiB)", 1810 Value: 768, 1811 Aliases: []string{"migration.dst.db.leveldb.cache-size"}, 1812 EnvVars: []string{"KLAYTN_DB_DST_LEVELDB_CACHE_SIZE"}, 1813 Category: "DATABASE MIGRATION", 1814 } 1815 DstLevelDBCompressionTypeFlag = &cli.IntFlag{ 1816 Name: "db.dst.leveldb.compression", 1817 Usage: "Determines the compression method for LevelDB. 0=AllNoCompression, 1=ReceiptOnlySnappyCompression, 2=StateTrieOnlyNoCompression, 3=AllSnappyCompression", 1818 Value: 0, 1819 Aliases: []string{"migration.dst.db.leveldb.compression"}, 1820 EnvVars: []string{"KLAYTN_DB_DST_LEVELDB_COMPRESSION"}, 1821 Category: "DATABASE MIGRATION", 1822 } 1823 DstNumStateTrieShardsFlag = &cli.UintFlag{ 1824 Name: "db.dst.num-statetrie-shards", 1825 Usage: "Number of internal shards of state trie DB shards. Should be power of 2", 1826 Value: 4, 1827 Aliases: []string{"migration.dst.db.leveldb.num-statetrie-shards"}, 1828 EnvVars: []string{"KLAYTN_DB_DST_NUM_STATETRIE_SHARDS"}, 1829 Category: "DATABASE MIGRATION", 1830 } 1831 DstDynamoDBTableNameFlag = &cli.StringFlag{ 1832 Name: "db.dst.dynamo.tablename", 1833 Usage: "Specifies DynamoDB table name. This is mandatory to use dynamoDB. (Set dbtype to use DynamoDBS3). If dstDB is singleDB, tableName should be in form of 'PREFIX-TABLENAME'.(e.g. 'klaytn-misc', 'klaytn-statetrie')", 1834 Aliases: []string{"migration.dst.db.dynamo.table-name"}, 1835 EnvVars: []string{"KLAYTN_DB_DST_DYNAMO_TABLENAME"}, 1836 Category: "DATABASE MIGRATION", 1837 } 1838 DstDynamoDBRegionFlag = &cli.StringFlag{ 1839 Name: "db.dst.dynamo.region", 1840 Usage: "AWS region where the DynamoDB will be created.", 1841 Value: database.GetDefaultDynamoDBConfig().Region, 1842 Aliases: []string{"migration.dst.db.dynamo.region"}, 1843 EnvVars: []string{"KLAYTN_DB_DST_DYNAMO_REGION"}, 1844 Category: "DATABASE MIGRATION", 1845 } 1846 DstDynamoDBIsProvisionedFlag = &cli.BoolFlag{ 1847 Name: "db.dst.dynamo.is-provisioned", 1848 Usage: "Set DynamoDB billing mode to provision. The default billing mode is on-demand.", 1849 Aliases: []string{"migration.dst.db.dynamo.is-provisioned"}, 1850 EnvVars: []string{"KLAYTN_DB_DST_DYNAMO_IS_PROVISIONED"}, 1851 Category: "DATABASE MIGRATION", 1852 } 1853 DstDynamoDBReadCapacityFlag = &cli.Int64Flag{ 1854 Name: "db.dst.dynamo.read-capacity", 1855 Usage: "Read capacity unit of dynamoDB. If is-provisioned is not set, this flag will not be applied.", 1856 Value: database.GetDefaultDynamoDBConfig().ReadCapacityUnits, 1857 Aliases: []string{"migration.dst.db.dynamo.read-capacity"}, 1858 EnvVars: []string{"KLAYTN_DB_DST_DYNAMO_READ_CAPACITY"}, 1859 Category: "DATABASE MIGRATION", 1860 } 1861 DstDynamoDBWriteCapacityFlag = &cli.Int64Flag{ 1862 Name: "db.dst.dynamo.write-capacity", 1863 Usage: "Write capacity unit of dynamoDB. If is-provisioned is not set, this flag will not be applied", 1864 Value: database.GetDefaultDynamoDBConfig().WriteCapacityUnits, 1865 Aliases: []string{"migration.dst.db.dynamo.write-capacity"}, 1866 EnvVars: []string{"KLAYTN_DB_DST_DYNAMO_WRITE_CAPACITY"}, 1867 Category: "DATABASE MIGRATION", 1868 } 1869 DstRocksDBSecondaryFlag = &cli.BoolFlag{ 1870 Name: "db.dst.rocksdb.secondary", 1871 Usage: "Enable rocksdb secondary mode (read-only and catch-up with primary node dynamically)", 1872 Aliases: []string{"migration.dst.db.rocksdb.secondary"}, 1873 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_SECONDARY"}, 1874 Category: "DATABASE MIGRATION", 1875 } 1876 DstRocksDBCacheSizeFlag = &cli.Uint64Flag{ 1877 Name: "db.dst.rocksdb.cache-size", 1878 Usage: "Size of in-memory cache in RocksDB (MiB)", 1879 Value: 768, 1880 Aliases: []string{"migration.dst.db.rocksdb.cache-size"}, 1881 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_CACHE_SIZE"}, 1882 Category: "DATABASE MIGRATION", 1883 } 1884 DstRocksDBDumpMallocStatFlag = &cli.BoolFlag{ 1885 Name: "db.dst.rocksdb.dump-memory-stat", 1886 Usage: "Enable to print memory stat together with rocksdb.stat. Works with Jemalloc only.", 1887 Aliases: []string{"migration.dst.db.rocksdb.dump-malloc-stat"}, 1888 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_DUMP_MALLOC_STAT"}, 1889 Category: "DATABASE MIGRATION", 1890 } 1891 DstRocksDBCompressionTypeFlag = &cli.StringFlag{ 1892 Name: "db.dst.rocksdb.compression-type", 1893 Usage: "RocksDB block compression type. Supported values are 'no', 'snappy', 'zlib', 'bz', 'lz4', 'lz4hc', 'xpress', 'zstd'", 1894 Value: database.GetDefaultRocksDBConfig().CompressionType, 1895 Aliases: []string{"migration.dst.db.rocksdb.compression-type"}, 1896 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_COMPRESSION_TYPE"}, 1897 Category: "DATABASE MIGRATION", 1898 } 1899 DstRocksDBBottommostCompressionTypeFlag = &cli.StringFlag{ 1900 Name: "db.dst.rocksdb.bottommost-compression-type", 1901 Usage: "RocksDB bottommost block compression type. Supported values are 'no', 'snappy', 'zlib', 'bz2', 'lz4', 'lz4hc', 'xpress', 'zstd'", 1902 Value: database.GetDefaultRocksDBConfig().BottommostCompressionType, 1903 Aliases: []string{"migration.dst.db.rocksdb.bottommost-compression-type"}, 1904 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_BOTTOMMOST_COMPRESSION_TYPE"}, 1905 Category: "DATABASE MIGRATION", 1906 } 1907 DstRocksDBFilterPolicyFlag = &cli.StringFlag{ 1908 Name: "db.dst.rocksdb.filter-policy", 1909 Usage: "RocksDB filter policy. Supported values are 'no', 'bloom', 'ribbon'", 1910 Value: database.GetDefaultRocksDBConfig().FilterPolicy, 1911 Aliases: []string{"migration.dst.db.rocksdb.filter-policy"}, 1912 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_FILTER_POLICY"}, 1913 Category: "DATABASE MIGRATION", 1914 } 1915 DstRocksDBDisableMetricsFlag = &cli.BoolFlag{ 1916 Name: "db.dst.rocksdb.disable-metrics", 1917 Usage: "Disable RocksDB metrics", 1918 Aliases: []string{"migration.dst.db.rocksdb.disable-metrics"}, 1919 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_DISABLE_METRICS"}, 1920 Category: "DATABASE MIGRATION", 1921 } 1922 DstRocksDBMaxOpenFilesFlag = &cli.IntFlag{ 1923 Name: "db.dst.rocksdb.max-open-files", 1924 Usage: "Set RocksDB max open files. (the value should be greater than 16)", 1925 Value: database.GetDefaultRocksDBConfig().MaxOpenFiles, 1926 Aliases: []string{"migration.dst.db.rocksdb.max-open-files"}, 1927 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_MAX_OPEN_FILES"}, 1928 Category: "DATABASE MIGRATION", 1929 } 1930 DstRocksDBCacheIndexAndFilterFlag = &cli.BoolFlag{ 1931 Name: "db.dst.rocksdb.cache-index-and-filter", 1932 Usage: "Use block cache for index and filter blocks.", 1933 Aliases: []string{"migration.dst.db.rocksdb.cache-index-and-filter"}, 1934 EnvVars: []string{"KLAYTN_DB_DST_ROCKSDB_CACHE_INDEX_AND_FILTER"}, 1935 Category: "DATABASE MIGRATION", 1936 } 1937 1938 // Config 1939 ConfigFileFlag = &cli.StringFlag{ 1940 Name: "config", 1941 Usage: "TOML configuration file", 1942 Aliases: []string{}, 1943 EnvVars: []string{"KLAYTN_CONFIG"}, 1944 Category: "KLAY", 1945 } 1946 BlockGenerationIntervalFlag = &cli.Int64Flag{ 1947 Name: "block-generation-interval", 1948 Usage: "(experimental option) Set the block generation interval in seconds. " + 1949 "It should be equal or larger than 1. This flag is only applicable to CN.", 1950 Value: params.DefaultBlockGenerationInterval, 1951 Aliases: []string{"experimental.block-generation-interval"}, 1952 EnvVars: []string{"KLAYTN_BLOCK_GENERATION_INTERVAL"}, 1953 Category: "KLAY", 1954 } 1955 BlockGenerationTimeLimitFlag = &cli.DurationFlag{ 1956 Name: "block-generation-time-limit", 1957 Usage: "(experimental option) Set the vm execution time limit during block generation. " + 1958 "Less than half of the block generation interval is recommended for this value. " + 1959 "This flag is only applicable to CN", 1960 Value: params.DefaultBlockGenerationTimeLimit, 1961 Aliases: []string{"experimental.block-generation-time-limit"}, 1962 EnvVars: []string{"KLAYTN_BLOCK_GENERATION_TIME_LIMIT"}, 1963 Category: "KLAY", 1964 } 1965 OpcodeComputationCostLimitFlag = &cli.Uint64Flag{ 1966 Name: "opcode-computation-cost-limit", 1967 Usage: "(experimental option) Set the computation cost limit for a tx. " + 1968 "Should set the same value within the network", 1969 Aliases: []string{"experimental.opcode-computation-cost-limit"}, 1970 EnvVars: []string{"KLAYTN_OPCODE_COMPUTATION_COST_LIMIT"}, 1971 Category: "KLAY", 1972 } 1973 1974 // TODO-Klaytn-Bootnode: Add bootnode's metric options 1975 // TODO-Klaytn-Bootnode: Implements bootnode's RPC 1976 ) 1977 1978 // MakeDataDir retrieves the currently requested data directory, terminating 1979 // if none (or the empty string) is specified. If the node is starting a baobab, 1980 // the a subdirectory of the specified datadir will be used. 1981 func MakeDataDir(ctx *cli.Context) string { 1982 if path := ctx.String(DataDirFlag.Name); path != "" { 1983 if ctx.Bool(BaobabFlag.Name) { 1984 return filepath.Join(path, "baobab") 1985 } 1986 return path 1987 } 1988 log.Fatalf("Cannot determine default data directory, please set manually (--datadir)") 1989 return "" 1990 } 1991 1992 // splitAndTrim splits input separated by a comma 1993 // and trims excessive white space from the substrings. 1994 func SplitAndTrim(input string) []string { 1995 result := strings.Split(input, ",") 1996 for i, r := range result { 1997 result[i] = strings.TrimSpace(r) 1998 } 1999 return result 2000 } 2001 2002 // MakePasswordList reads password lines from the file specified by the global --password flag. 2003 func MakePasswordList(ctx *cli.Context) []string { 2004 path := ctx.String(PasswordFileFlag.Name) 2005 if path == "" { 2006 return nil 2007 } 2008 text, err := os.ReadFile(path) 2009 if err != nil { 2010 log.Fatalf("Failed to read password file: %v", err) 2011 } 2012 lines := strings.Split(string(text), "\n") 2013 // Sanitise DOS line endings. 2014 for i := range lines { 2015 lines[i] = strings.TrimRight(lines[i], "\r") 2016 } 2017 return lines 2018 } 2019 2020 // RegisterCNService adds a CN client to the stack. 2021 func RegisterCNService(stack *node.Node, cfg *cn.Config) { 2022 // TODO-Klaytn add syncMode.LightSync func and add LesServer 2023 2024 err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { 2025 cfg.WsEndpoint = stack.WSEndpoint() 2026 fullNode, err := cn.New(ctx, cfg) 2027 return fullNode, err 2028 }) 2029 if err != nil { 2030 log.Fatalf("Failed to register the CN service: %v", err) 2031 } 2032 } 2033 2034 func RegisterService(stack *node.Node, cfg *sc.SCConfig) { 2035 if cfg.EnabledMainBridge { 2036 err := stack.RegisterSubService(func(ctx *node.ServiceContext) (node.Service, error) { 2037 mainBridge, err := sc.NewMainBridge(ctx, cfg) 2038 return mainBridge, err 2039 }) 2040 if err != nil { 2041 log.Fatalf("Failed to register the main bridge service: %v", err) 2042 } 2043 } 2044 2045 if cfg.EnabledSubBridge { 2046 err := stack.RegisterSubService(func(ctx *node.ServiceContext) (node.Service, error) { 2047 subBridge, err := sc.NewSubBridge(ctx, cfg) 2048 return subBridge, err 2049 }) 2050 if err != nil { 2051 log.Fatalf("Failed to register the sub bridge service: %v", err) 2052 } 2053 } 2054 } 2055 2056 // RegisterChainDataFetcherService adds a ChainDataFetcher to the stack 2057 func RegisterChainDataFetcherService(stack *node.Node, cfg *chaindatafetcher.ChainDataFetcherConfig) { 2058 if cfg.EnabledChainDataFetcher { 2059 err := stack.RegisterSubService(func(ctx *node.ServiceContext) (node.Service, error) { 2060 chainDataFetcher, err := chaindatafetcher.NewChainDataFetcher(ctx, cfg) 2061 return chainDataFetcher, err 2062 }) 2063 if err != nil { 2064 log.Fatalf("Failed to register the service: %v", err) 2065 } 2066 } 2067 } 2068 2069 // RegisterDBSyncerService adds a DBSyncer to the stack 2070 func RegisterDBSyncerService(stack *node.Node, cfg *dbsyncer.DBConfig) { 2071 if cfg.EnabledDBSyncer { 2072 err := stack.RegisterSubService(func(ctx *node.ServiceContext) (node.Service, error) { 2073 dbImporter, err := dbsyncer.NewDBSyncer(ctx, cfg) 2074 return dbImporter, err 2075 }) 2076 if err != nil { 2077 log.Fatalf("Failed to register the service: %v", err) 2078 } 2079 } 2080 } 2081 2082 // MakeConsolePreloads retrieves the absolute paths for the console JavaScript 2083 // scripts to preload before starting. 2084 func MakeConsolePreloads(ctx *cli.Context) []string { 2085 // Skip preloading if there's nothing to preload 2086 if ctx.String(PreloadJSFlag.Name) == "" { 2087 return nil 2088 } 2089 // Otherwise resolve absolute paths and return them 2090 var preloads []string 2091 2092 assets := ctx.String(JSpathFlag.Name) 2093 for _, file := range strings.Split(ctx.String(PreloadJSFlag.Name), ",") { 2094 preloads = append(preloads, common.AbsolutePath(assets, strings.TrimSpace(file))) 2095 } 2096 return preloads 2097 } 2098 2099 // MigrateFlags sets the global flag from a local flag when it's set. 2100 // This is a temporary function used for migrating old command/flags to the 2101 // new format. 2102 // 2103 // e.g. ken account new --keystore /tmp/mykeystore --lightkdf 2104 // 2105 // is equivalent after calling this method with: 2106 // 2107 // ken --keystore /tmp/mykeystore --lightkdf account new 2108 // 2109 // This allows the use of the existing configuration functionality. 2110 // When all flags are migrated this function can be removed and the existing 2111 // configuration functionality must be changed that is uses local flags 2112 // Deprecated: urfave/cli/v2 doesn't support local scope flag and there is only global scope. 2113 func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error { 2114 return func(ctx *cli.Context) error { 2115 for _, name := range ctx.FlagNames() { 2116 if ctx.IsSet(name) { 2117 ctx.Set(name, ctx.String(name)) 2118 } 2119 } 2120 return action(ctx) 2121 } 2122 } 2123 2124 // CheckExclusive verifies that only a single instance of the provided flags was 2125 // set by the user. Each flag might optionally be followed by a string type to 2126 // specialize it further. 2127 func CheckExclusive(ctx *cli.Context, args ...interface{}) { 2128 set := make([]string, 0, 1) 2129 for i := 0; i < len(args); i++ { 2130 // Make sure the next argument is a flag and skip if not set 2131 flag, ok := args[i].(cli.Flag) 2132 if !ok { 2133 panic(fmt.Sprintf("invalid argument, not cli.Flag type: %T", args[i])) 2134 } 2135 // Check if next arg extends current and expand its name if so 2136 name := flag.Names()[0] 2137 2138 if i+1 < len(args) { 2139 switch option := args[i+1].(type) { 2140 case string: 2141 // Extended flag, expand the name and shift the arguments 2142 if ctx.String(flag.Names()[0]) == option { 2143 name += "=" + option 2144 } 2145 i++ 2146 2147 case cli.Flag: 2148 default: 2149 panic(fmt.Sprintf("invalid argument, not cli.Flag or string extension: %T", args[i+1])) 2150 } 2151 } 2152 // Mark the flag if it's set 2153 if ctx.IsSet(flag.Names()[0]) { 2154 set = append(set, "--"+name) 2155 } 2156 } 2157 if len(set) > 1 { 2158 log.Fatalf("Flags %v can't be used at the same time", strings.Join(set, ", ")) 2159 } 2160 } 2161 2162 // FlagString prints a single flag in help. 2163 func FlagString(f cli.Flag) string { 2164 df, ok := f.(cli.DocGenerationFlag) 2165 if !ok { 2166 return "" 2167 } 2168 2169 needsPlaceholder := df.TakesValue() 2170 placeholder := "" 2171 if needsPlaceholder { 2172 placeholder = "value" 2173 } 2174 2175 // namesText := cli.FlagNamePrefixer([]string{df.Names()[0]}, placeholder) 2176 // if len(df.Names()) > 1 { 2177 // namesText = cli.FlagNamePrefixer([]string{df.Names()[1]}, placeholder) 2178 // } 2179 namesText := cli.FlagNamePrefixer(df.Names(), placeholder) 2180 2181 defaultValueString := "" 2182 if s := df.GetDefaultText(); s != "" { 2183 defaultValueString = " (default: " + s + ")" 2184 } 2185 2186 usage := strings.TrimSpace(df.GetUsage()) 2187 envHint := strings.TrimSpace(cli.FlagEnvHinter(df.GetEnvVars(), "")) 2188 if len(envHint) > 0 { 2189 usage += "\nEnvVar: " + envHint 2190 } 2191 2192 // usage = wordWrap(usage, 150) 2193 usage = indent(usage, 10) 2194 return fmt.Sprintf("\n %s%s\n%s", namesText, defaultValueString, usage) 2195 } 2196 2197 func indent(s string, nspace int) string { 2198 ind := strings.Repeat(" ", nspace) 2199 return ind + strings.ReplaceAll(s, "\n", "\n"+ind) 2200 }