From 9309279a2a08349e1a012c7d266b944194e61606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Vincent?= <28714795+leovct@users.noreply.github.com> Date: Wed, 5 Jul 2023 17:03:30 +0200 Subject: [PATCH] doc: book cli updater (#3576) --- .github/workflows/book.yml | 21 +- Makefile | 6 + book/cli/cli.md | 12 +- book/cli/config.json | 33 ++ book/cli/config.md | 13 +- book/cli/db.md | 444 ++++++++++++++++--- book/cli/debug.md | 261 +++++++---- book/cli/import.md | 40 +- book/cli/init.md | 27 +- book/cli/node.md | 164 ++++--- book/cli/p2p.md | 131 ++++-- book/cli/stage.md | 860 +++++++++++++++++++++++++++---------- book/cli/test-vectors.md | 91 +++- book/cli/update.sh | 128 ++++++ 14 files changed, 1721 insertions(+), 510 deletions(-) create mode 100644 book/cli/config.json create mode 100755 book/cli/update.sh diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 684acb8e9..3e29f13a5 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -105,11 +105,30 @@ jobs: retention-days: 1 if-no-files-found: error + up-to-date: + runs-on: ubuntu-latest + name: up-to-date + + steps: + - uses: actions/checkout@v3 + + - name: Try to update the book cli documentation + run: make update-book-cli BUILD_PATH=reth/target + + - name: Check if the book cli documentation is up to date + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "Error: Documentation is not up to date. Please run \`make update-book-cli\`." + exit 1 + else + echo "The documentation is up to date." + fi + deploy: # Only deploy if a push to main if: github.ref_name == 'main' && github.event_name == 'push' runs-on: ubuntu-latest - needs: [test, lint, build] + needs: [test, lint, build, up-to-date] # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: diff --git a/Makefile b/Makefile index d49d427b9..68b8fd3ba 100644 --- a/Makefile +++ b/Makefile @@ -196,3 +196,9 @@ db-tools: ## Compile MDBX debugging tools. @$(MAKE) -C $(MDBX_PATH) IOARENA=1 clean > /dev/null @echo "Run \"$(DB_TOOLS_DIR)/mdbx_stat\" for the info about MDBX db file." @echo "Run \"$(DB_TOOLS_DIR)/mdbx_chk\" for the MDBX db file integrity check." + +.PHONY: update-book-cli +update-book-cli: ## Update book cli documentation. + cargo build --bin reth --features "$(FEATURES)" --profile "$(PROFILE)" + @echo "Updating book cli doc..." + @./book/cli/update.sh $(BUILD_PATH) diff --git a/book/cli/cli.md b/book/cli/cli.md index 300b5361a..22bd8e309 100644 --- a/book/cli/cli.md +++ b/book/cli/cli.md @@ -39,7 +39,7 @@ Commands: db Database debugging utilities stage - Manipulate individual stages. + Manipulate individual stages p2p P2P Debugging utilities test-vectors @@ -64,21 +64,21 @@ Logging: --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info diff --git a/book/cli/config.json b/book/cli/config.json new file mode 100644 index 000000000..355e5c37d --- /dev/null +++ b/book/cli/config.json @@ -0,0 +1,33 @@ +{ + "commands": { + "config": [], + "db": { + "stats": [], + "list": [], + "get": [], + "drop": [], + "version": [], + "path": [] + }, + "debug": { + "execution": [], + "merkle": [] + }, + "import": [], + "init": [], + "node": [], + "p2p": { + "header": [], + "body": [] + }, + "stage": { + "run": [], + "drop": [], + "dump": ["execution", "storage-hashing", "account-hashing", "merkle"], + "unwind": ["to-block", "num-blocks"] + }, + "test-vectors": { + "tables": [] + } + } +} diff --git a/book/cli/config.md b/book/cli/config.md index 39cb09462..9f0d2f657 100644 --- a/book/cli/config.md +++ b/book/cli/config.md @@ -14,27 +14,30 @@ Options: --default Show the default config + -h, --help + Print help (see a summary with '-h') + Logging: --log.persistent The flag to enable persistent logs --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info diff --git a/book/cli/db.md b/book/cli/db.md index 370fbdb0a..c06640a9b 100644 --- a/book/cli/db.md +++ b/book/cli/db.md @@ -26,59 +26,210 @@ Commands: Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` - + [default: default] --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] -h, --help Print help (see a summary with '-h') +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info -vvvv Debug -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` -## `reth db stats` +## `reth db drop` + +Deletes all database entries ```bash -$ reth db stats --help -Lists all the tables, their entry count and their size +$ reth db drop --help -Usage: reth db stats [OPTIONS] +Usage: reth db drop [OPTIONS] Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + -h, --help Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +## `reth db get` + +Gets the content of a table for the given key + +```bash +$ reth db get --help + +Usage: reth db get [OPTIONS] + +Arguments: +
+ The table name + + NOTE: The dupsort tables are not supported now. + + + The key to get content for + +Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` ## `reth db list` +Lists the contents of a table + ```bash $ reth db list --help -Lists the contents of a table Usage: reth db list [OPTIONS]
@@ -87,53 +238,219 @@ Arguments: The table name Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + -s, --skip Skip first N entries - + [default: 0] - -r, --reverse - Reverse the order of the entries. If enabled last table entries are read. + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] - [default: false] + -r, --reverse + Reverse the order of the entries. If enabled last table entries are read -l, --len How many items to take from the walker - + [default: 5] -j, --json - Dump as JSON instead of using TUI. + Dump as JSON instead of using TUI -h, --help Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` -## `reth db get` +## `reth db path` + +Returns the full database path ```bash -$ reth db get --help -Gets the content of a table for the given key +$ reth db path --help -Usage: reth db get [OPTIONS]
- -Arguments: -
- The table name +Usage: reth db path [OPTIONS] Options: - --key - The key to get content for + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] -h, --help Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +## `reth db stats` + +Lists all the tables, their entry count and their size + +```bash +$ reth db stats --help + +Usage: reth db stats [OPTIONS] + +Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` ## `reth db version` +Lists current and local database versions + ```bash $ reth db version --help -Lists current and local database versions Usage: reth db version [OPTIONS] @@ -163,43 +480,34 @@ Options: -h, --help Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` - -## `reth db drop` - -```bash -$ reth db drop --help -Deletes all database entries - -Usage: reth db drop [OPTIONS] - -Options: - -h, --help - Print help (see a summary with '-h') -``` - -## `reth db version` - -```bash -$ reth db version --help -Lists current and local database versions - -Usage: reth db version [OPTIONS] - -Options: - -h, --help - Print help (see a summary with '-h') -``` - -## `reth db path` - -```bash -$ reth db path --help -Returns the full database path - -Usage: reth db path [OPTIONS] - -Options: - -h, --help - Print help (see a summary with '-h') -``` \ No newline at end of file diff --git a/book/cli/debug.md b/book/cli/debug.md index fe152136b..586a72649 100644 --- a/book/cli/debug.md +++ b/book/cli/debug.md @@ -1,40 +1,45 @@ # `reth debug` +Various debug routines + ```bash $ reth debug --help -Various debug routines -Usage: reth debug +Usage: reth debug [OPTIONS] Commands: execution - Debug the roundtrip execution of blocks as well as the generated data. + Debug the roundtrip execution of blocks as well as the generated data merkle - Debug the clean & incremental state root calculations. + Debug the clean & incremental state root calculations help Print this message or the help of the given subcommand(s) +Options: + -h, --help + Print help (see a summary with '-h') + Logging: --log.persistent The flag to enable persistent logs --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info @@ -47,127 +52,203 @@ Display: ## `reth debug execution` +Debug the roundtrip execution of blocks as well as the generated data + ```bash $ reth debug execution --help -Debug the roundtrip execution of blocks as well as the generated data. -Usage: reth debug execution [OPTIONS] +Usage: reth debug execution [OPTIONS] --to Options: - --datadir - The path to the data dir for all reth files and subdirectories. + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] - Defaults to the OS-specific data directory: + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] - - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - - Windows: `{FOLDERID_RoamingAppData}/reth/` - - macOS: `$HOME/Library/Application Support/reth/` - - --chain - The chain this node is running. - - Possible values are either a built-in chain or the path to a chain specification file. - - Built-in chains: - - mainnet - - goerli - - sepolia - - [default: mainnet] - - --debug.tip - Set the chain tip manually for testing purposes. - - --to - The maximum block height. - - --interval - The block interval for sync and unwind. - - [default: 1000] + -h, --help + Print help (see a summary with '-h') Networking: - -d, --disable-discovery - Disable the discovery service + -d, --disable-discovery + Disable the discovery service - --disable-dns-discovery - Disable the DNS discovery + --disable-dns-discovery + Disable the DNS discovery - --disable-discv4-discovery - Disable Discv4 discovery + --disable-discv4-discovery + Disable Discv4 discovery - --discovery.port - The UDP port to use for P2P discovery/networking. default: 30303 + --discovery.port + The UDP port to use for P2P discovery/networking. default: 30303 - --trusted-peers - Target trusted peer enodes --trusted-peers enode://abcd@192.168.0.1:30303 + --trusted-peers + Target trusted peer enodes --trusted-peers enode://abcd@192.168.0.1:30303 - --trusted-only - Connect only to trusted peers + --trusted-only + Connect only to trusted peers - --bootnodes - Bootnodes to connect to initially. + --bootnodes + Bootnodes to connect to initially. + + Will fall back to a network-specific default if not specified. - Will fall back to a network-specific default if not specified. + --peers-file + The path to the known peers file. Connected peers are dumped to this file on nodes + shutdown, and read on startup. Cannot be used with `--no-persist-peers`. - --peers-file - The path to the known peers file. Connected peers are dumped to this file on nodes - shutdown, and read on startup. Cannot be used with `--no-persist-peers`. + --identity + Custom node identity + + [default: reth/v0.1.0-alpha.1/aarch64-apple-darwin] - --identity - Custom node identity + --p2p-secret-key + Secret key to use for this node. + + This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used. - --p2p-secret-key - Secret key to use for this node. + --no-persist-peers + Do not persist peers. - This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used. + --nat + NAT resolution method (any|none|upnp|publicip|extip:) + + [default: any] - --no-persist-peers - Do not persist peers. + --port + Network listening port. default: 30303 - --nat - NAT resolution method + --to + The maximum block height - [default: any] + --interval + The block interval for sync and unwind. Defaults to `1000` + + [default: 1000] - --port - Network listening port. default: 30303 +Debug: + --debug.tip + Set the chain tip manually for testing purposes. + + NOTE: This is a temporary flag +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` ## `reth debug merkle` +Debug the clean & incremental state root calculations + ```bash $ reth debug merkle --help -Debug the clean & incremental state root calculations. -Usage: reth debug merkle [OPTIONS] +Usage: reth debug merkle [OPTIONS] --to Options: - --datadir - The path to the data dir for all reth files and subdirectories. + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] - Defaults to the OS-specific data directory: + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] - - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - - Windows: `{FOLDERID_RoamingAppData}/reth/` - - macOS: `$HOME/Library/Application Support/reth/` + --to + The height to finish at - --chain - The chain this node is running. + --skip-node-depth + The depth after which we should start comparing branch nodes - Possible values are either a built-in chain or the path to a chain specification file. + -h, --help + Print help (see a summary with '-h') - Built-in chains: - - mainnet - - goerli - - sepolia +Logging: + --log.persistent + The flag to enable persistent logs - [default: mainnet] + --log.directory + The path to put log files in + + [default: /reth/logs] - --to - The height to finish at + --log.journald + Log events to journald - --skip-node-depth - The depth after which we should start comparing branch nodes + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` diff --git a/book/cli/import.md b/book/cli/import.md index 55e9012a8..ec79c91a6 100644 --- a/book/cli/import.md +++ b/book/cli/import.md @@ -1,9 +1,18 @@ # `reth import` +This syncs RLP encoded blocks from a file + ```bash $ reth import --help -Usage: reth import [OPTIONS] +Usage: reth import [OPTIONS] + +Arguments: + + The path to a block file for import. + + The online stages (headers and bodies) are replaced by a file import, after which the + remaining stages are executed. Options: --config @@ -11,30 +20,29 @@ Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] - --path - The path to a block file for import. - - The online stages (headers and bodies) are replaced by a file import, after which the - remaining stages are executed. + -h, --help + Print help (see a summary with '-h') Logging: --log.persistent @@ -42,21 +50,21 @@ Logging: --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info diff --git a/book/cli/init.md b/book/cli/init.md index e4684ca56..5517043fb 100644 --- a/book/cli/init.md +++ b/book/cli/init.md @@ -1,5 +1,7 @@ # `reth init` +Initialize the database from a genesis file + ```bash $ reth init --help @@ -8,46 +10,51 @@ Usage: reth init [OPTIONS] Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] + -h, --help + Print help (see a summary with '-h') + Logging: --log.persistent The flag to enable persistent logs --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info diff --git a/book/cli/node.md b/book/cli/node.md index a6b53dcf0..64b62d480 100644 --- a/book/cli/node.md +++ b/book/cli/node.md @@ -1,24 +1,22 @@ # `reth node` -The main node operator command. +Start the node ```bash $ reth node --help -Start the node - Usage: reth node [OPTIONS] Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` - + [default: default] --config @@ -26,26 +24,23 @@ Options: --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] - --auto-mine - Automatically mine blocks for new transactions - -h, --help Print help (see a summary with '-h') Metrics: --metrics Enable Prometheus metrics. - + The metrics will be served at the given interface and port. Networking: @@ -69,7 +64,7 @@ Networking: --bootnodes Bootnodes to connect to initially. - + Will fall back to a network-specific default if not specified. --peers-file @@ -78,24 +73,26 @@ Networking: --identity Custom node identity + + [default: reth/v0.1.0-alpha.1/aarch64-apple-darwin] --p2p-secret-key Secret key to use for this node. - + This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used. --no-persist-peers Do not persist peers. --nat - NAT resolution method - + NAT resolution method (any|none|upnp|publicip|extip:) + [default: any] --port Network listening port. default: 30303 -Rpc: +RPC: --http Enable the HTTP-RPC server @@ -106,7 +103,9 @@ Rpc: Http server port to listen on --http.api - Rpc Modules to be configured for http server + Rpc Modules to be configured for the HTTP server + + [possible values: admin, debug, eth, net, trace, txpool, web3, rpc] --http.corsdomain Http Corsdomain to allow request from @@ -124,7 +123,9 @@ Rpc: Origins from which to accept WebSocket requests --ws.api - Rpc Modules to be configured for Ws server + Rpc Modules to be configured for the WS server + + [possible values: admin, debug, eth, net, trace, txpool, web3, rpc] --ipcdisable Disable the IPC-RPC server @@ -141,53 +142,102 @@ Rpc: --authrpc.jwtsecret Path to a JWT secret to use for authenticated RPC endpoints - --rpc-max-request-size - Set the maximum RPC request payload size for both HTTP and WS in megabytes. + --rpc-max-request-size + Set the maximum RPC request payload size for both HTTP and WS in megabytes + + [default: 15] - --rpc-max-response-size - Set the maximum RPC response payload size for both HTTP and WS in megabytes. + --rpc-max-response-size + Set the maximum RPC response payload size for both HTTP and WS in megabytes + + [default: 100] - --rpc-max-subscriptions-per-connection - Set the the maximum concurrent subscriptions per connection. + --rpc-max-subscriptions-per-connection + Set the the maximum concurrent subscriptions per connection + + [default: 1024] - --rpc-max-connections - Maximum number of RPC server connections. + --rpc-max-connections + Maximum number of RPC server connections + + [default: 100] - --rpc-max-tracing-requests - Maximum number of concurrent tracing requests. + --rpc-max-tracing-requests + Maximum number of concurrent tracing requests + + [default: 25] - --gas-price-oracle - Gas price oracle configuration. + --rpc.gascap + Maximum gas limit for `eth_call` and call tracing RPC methods + + [default: 30000000] - --block-cache-len - Maximum number of block cache entries. +GAS PRICE ORACLE: + --gpo.blocks + Number of recent blocks to check for gas price + + [default: 20] - --receipt-cache-len - Maximum number of receipt cache entries. + --gpo.ignoreprice + Gas Price below which gpo will ignore transactions + + [default: 2] - --env-cache-len - Maximum number of env cache entries. + --gpo.maxprice + Maximum transaction priority fee(or gasprice before London Fork) to be recommended by gpo + + [default: 500000000000] + + --gpo.percentile + The percentile of gas prices to use for the estimate + + [default: 60] + + --block-cache-size + Max size for cached block data in megabytes + + [default: 500] + + --receipt-cache-size + Max size for cached receipt data in megabytes + + [default: 500] + + --env-cache-size + Max size for cached evm env data in megabytes + + [default: 1] Builder: - --builder.extradata - Block extra data set by the payload builder. + --builder.extradata + Block extra data set by the payload builder + + [default: reth/v0.1.0-alpha.1/macos] - --builder.gaslimit - Target gas ceiling for built blocks. + --builder.gaslimit + Target gas ceiling for built blocks + + [default: 30000000] - --builder.interval - The interval at which the job should build a new payload after the last (in seconds). + --builder.interval + The interval at which the job should build a new payload after the last (in seconds) + + [default: 1] - --builder.deadline - The deadline for when the payload builder job should resolve. + --builder.deadline + The deadline for when the payload builder job should resolve + + [default: 12] - --builder.max-tasks - Maximum number of tasks to spawn for building a payload. + --builder.max-tasks + Maximum number of tasks to spawn for building a payload + + [default: 3] Debug: --debug.continuous Prompt the downloader to download blocks one at a time. - + NOTE: This is for testing purposes only. --debug.terminate @@ -195,7 +245,7 @@ Debug: --debug.tip Set the chain tip manually for testing purposes. - + NOTE: This is a temporary flag --debug.max-block @@ -213,27 +263,31 @@ Debug: --debug.hook-all Hook on every transaction in a block +Rpc: + --auto-mine + Automatically mine blocks for new transactions + Logging: --log.persistent The flag to enable persistent logs --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. - + -v Errors -vv Warnings -vvv Info diff --git a/book/cli/p2p.md b/book/cli/p2p.md index 1796c858a..ddaa94133 100644 --- a/book/cli/p2p.md +++ b/book/cli/p2p.md @@ -1,8 +1,9 @@ # `reth p2p` +P2P Debugging utilities + ```bash $ reth p2p --help -P2P Debugging utilities Usage: reth p2p [OPTIONS] @@ -20,30 +21,30 @@ Options: --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` - + [default: default] --p2p-secret-key Secret key to use for this node. - + This also will deterministically set the peer ID. -d, --disable-discovery @@ -66,7 +67,7 @@ Options: --retries The number of retries per request - + [default: 5] --nat @@ -81,21 +82,69 @@ Logging: --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + -q, --quiet + Silence all log output +``` + +## `reth p2p body` + +Download block body + +```bash +$ reth p2p body --help + +Usage: reth p2p body [OPTIONS] + +Arguments: + + The block number or hash + +Options: + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + -v Errors -vv Warnings -vvv Info @@ -108,28 +157,48 @@ Display: ## `reth p2p header` -```bash -$ reth p2p header --help Download block header -Usage: reth p2p header +```bash +$ reth p2p header --help + +Usage: reth p2p header [OPTIONS] Arguments: The header number or hash -``` - - -## `reth p2p body` - - -```bash -$ reth p2p body --help -Download block body - -Usage: reth p2p body - -Arguments: - - The block number or hash + +Options: + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` diff --git a/book/cli/stage.md b/book/cli/stage.md index a89eb7b60..d23bc2bfa 100644 --- a/book/cli/stage.md +++ b/book/cli/stage.md @@ -1,26 +1,27 @@ # `reth stage` +Manipulate individual stages + ```bash $ reth stage --help -Usage: reth db +Usage: reth stage [OPTIONS] Commands: run - Run a single stage. - - Note that this won't use the Pipeline and as a result runs stages - assuming that all the data can be held in memory. It is not recommended - to run a stage for really large block ranges if your computer does not have - a lot of memory to store all the data. + Run a single stage drop - Drop a stage's tables from the database. + Drop a stage's tables from the database dump - Dumps a stage from a range into a new database. + Dumps a stage from a range into a new database unwind - Unwinds a certain block range, deleting it from the database. + Unwinds a certain block range, deleting it from the database help - Print this message or the help of the given subcommand(s) + Print this message or the help of the given subcommand(s) + +Options: + -h, --help + Print help (see a summary with '-h') Logging: --log.persistent @@ -28,21 +29,395 @@ Logging: --log.directory The path to put log files in - - [default: /Users/georgios/Library/Caches/reth/logs] + + [default: /reth/logs] --log.journald Log events to journald --log.filter The filter to use for logs written to the log file - - [default: debug] + + [default: error] Display: -v, --verbosity... Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + -q, --quiet + Silence all log output +``` + +## `reth stage drop` + +Drop a stage's tables from the database + +```bash +$ reth stage drop --help + +Usage: reth stage drop [OPTIONS] + +Arguments: + + [possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty] + +Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +## `reth stage dump` + +Dumps a stage from a range into a new database + +```bash +$ reth stage dump --help + +Usage: reth stage dump [OPTIONS] + +Commands: + execution + Execution stage + storage-hashing + StorageHashing stage + account-hashing + AccountHashing stage + merkle + Merkle stage + help + Print this message or the help of the given subcommand(s) + +Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +### `reth stage dump execution` + +Execution stage + +```bash +$ reth stage dump execution --help + +Usage: reth stage dump execution [OPTIONS] --output-db --from --to + +Options: + --output-db + The path to the new database folder. + + -f, --from + From which block + + -t, --to + To which block + + -d, --dry-run + If passed, it will dry-run a stage execution from the newly created database right after dumping + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +### `reth stage dump storage-hashing` + +StorageHashing stage + +```bash +$ reth stage dump storage-hashing --help + +Usage: reth stage dump storage-hashing [OPTIONS] --output-db --from --to + +Options: + --output-db + The path to the new database folder. + + -f, --from + From which block + + -t, --to + To which block + + -d, --dry-run + If passed, it will dry-run a stage execution from the newly created database right after dumping + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +### `reth stage dump account-hashing` + +AccountHashing stage + +```bash +$ reth stage dump account-hashing --help + +Usage: reth stage dump account-hashing [OPTIONS] --output-db --from --to + +Options: + --output-db + The path to the new database folder. + + -f, --from + From which block + + -t, --to + To which block + + -d, --dry-run + If passed, it will dry-run a stage execution from the newly created database right after dumping + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +### `reth stage dump merkle` + +Merkle stage + +```bash +$ reth stage dump merkle --help + +Usage: reth stage dump merkle [OPTIONS] --output-db --from --to + +Options: + --output-db + The path to the new database folder. + + -f, --from + From which block + + -t, --to + To which block + + -d, --dry-run + If passed, it will dry-run a stage execution from the newly created database right after dumping + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + -v Errors -vv Warnings -vvv Info @@ -55,14 +430,20 @@ Display: ## `reth stage run` -```bash -Usage: reth stage run [OPTIONS] --from --to --stage - Run a single stage. +Run a single stage. - Note that this won't use the Pipeline and as a result runs stages - assuming that all the data can be held in memory. It is not recommended - to run a stage for really large block ranges if your computer does not have - a lot of memory to store all the data. +```bash +$ reth stage run --help + +Note that this won't use the Pipeline and as a result runs stages assuming that all the data can be held in memory. It is not recommended to run a stage for really large block ranges if your computer does not have a lot of memory to store all the data. + +Usage: reth stage run [OPTIONS] --from --to + +Arguments: + + The name of the stage to run + + [possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty] Options: --config @@ -70,56 +451,46 @@ Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` - + [default: default] --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] --metrics Enable Prometheus metrics. - + The metrics will be served at the given interface and port. - --stage - The name of the stage to run - - [possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty] - --from The height to start at -t, --to The end of the stage - --batch-size + --batch-size Batch size for stage execution and unwind -s, --skip-unwind Normally, running the stage requires unwinding for stages that already have been run, in order to not rewrite to the same database slots. - + You can optionally skip the unwinding phase if you're syncing a block range that has not been synced before. - --commit - Commits the changes in the database. WARNING: potentially destructive. - - Useful when you want to run diagnostics on the database. - -h, --help Print help (see a summary with '-h') @@ -144,240 +515,283 @@ Networking: --bootnodes Bootnodes to connect to initially. - + Will fall back to a network-specific default if not specified. --peers-file The path to the known peers file. Connected peers are dumped to this file on nodes shutdown, and read on startup. Cannot be used with `--no-persist-peers`. - --identity + --identity Custom node identity + + [default: reth/v0.1.0-alpha.1/aarch64-apple-darwin] - --p2p-secret-key + --p2p-secret-key Secret key to use for this node. - - This will also deterministically set the peer ID. If not specified, it will be set in the - data dir for the chain being used. + + This will also deterministically set the peer ID. If not specified, it will be set in the data dir for the chain being used. --no-persist-peers Do not persist peers. --nat - NAT resolution method - + NAT resolution method (any|none|upnp|publicip|extip:) + [default: any] --port Network listening port. default: 30303 -``` -## `reth stage drop` + -c, --commit + Commits the changes in the database. WARNING: potentially destructive. + + Useful when you want to run diagnostics on the database. -```bash -Usage: reth stage drop [OPTIONS] - Drop a stage's tables from the database. +Logging: + --log.persistent + The flag to enable persistent logs -Arguments: - - The name of the stage to drop + --log.directory + The path to put log files in + + [default: /reth/logs] - [possible values: headers, bodies, senders, execution, account-hashing, storage-hashing, hashing, merkle, tx-lookup, history, account-history, storage-history, total-difficulty] + --log.journald + Log events to journald -Options: - --datadir - The path to the data dir for all reth files and subdirectories. + --log.filter + The filter to use for logs written to the log file + + [default: error] - Defaults to the OS-specific data directory: +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) - - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - - Windows: `{FOLDERID_RoamingAppData}/reth/` - - macOS: `$HOME/Library/Application Support/reth/` - - [default: default] - - --chain - The chain this node is running. - - Possible values are either a built-in chain or the path to a chain specification file. - - Built-in chains: - - mainnet - - goerli - - sepolia - - [default: mainnet] -``` - -## `reth stage dump` - -```bash -Usage: reth stage dump [OPTIONS] - Dumps a stage from a range into a new database. - -Commands: - execution - Execution stage. - storage-hashing - StorageHashing stage. - account-hashing - AccountHashing stage. - merkle - Merkle stage. - help - Print this message or the help of the given subcommand(s) - -Options: - --datadir - The path to the data dir for all reth files and subdirectories. - - Defaults to the OS-specific data directory: - - - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - - Windows: `{FOLDERID_RoamingAppData}/reth/` - - macOS: `$HOME/Library/Application Support/reth/` - - [default: default] - - --chain - The chain this node is running. - - Possible values are either a built-in chain or the path to a chain specification file. - - Built-in chains: - - mainnet - - goerli - - sepolia - - [default: mainnet] -``` - -### `reth stage dump execution` - -```bash -Usage: reth stage dump execution [OPTIONS] - Execution stage. - -Options: - --output_db - The path to the new database folder. - - -f, --from - From which block. - - -t, --to - To which block. - - -d, --dry-run - If passed, it will dry-run a stage execution from the newly created database right after - dumping. - - [default: false] -``` - -### `reth stage dump storage-hashing` - -```bash -Usage: reth stage dump storage-hashing [OPTIONS] - StorageHashing stage. - -Options: - --output_db - The path to the new database folder. - - -f, --from - From which block. - - -t, --to - To which block. - - -d, --dry-run - If passed, it will dry-run a stage execution from the newly created database right after - dumping. - - [default: false] -``` - -### `reth stage dump account-hashing` - -```bash -Usage: reth stage dump account-hashing [OPTIONS] - AccountHashing stage. - -Options: - --output_db - The path to the new database folder. - - -f, --from - From which block. - - -t, --to - To which block. - - -d, --dry-run - If passed, it will dry-run a stage execution from the newly created database right after - dumping. - - [default: false] -``` - -### `reth stage dump merkle` - -```bash -Usage: reth stage dump merkle [OPTIONS] - Merkle stage. - -Options: - --output_db - The path to the new database folder. - - -f, --from - From which block. - - -t, --to - To which block. - -d, --dry-run - If passed, it will dry-run a stage execution from the newly created database right after - dumping. - - [default: false] + -q, --quiet + Silence all log output ``` ## `reth stage unwind` +Unwinds a certain block range, deleting it from the database + ```bash +$ reth stage unwind --help + Usage: reth stage unwind [OPTIONS] - Unwinds a certain block range, deleting it from the database. Commands: to-block - Unwinds the database until the given block number (range is inclusive). + Unwinds the database until the given block number (range is inclusive) num-blocks - Unwinds the given number of blocks from the database. + Unwinds the given number of blocks from the database help - Print this message or the help of the given subcommand(s) + Print this message or the help of the given subcommand(s) Options: --datadir The path to the data dir for all reth files and subdirectories. - + Defaults to the OS-specific data directory: - + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` - Windows: `{FOLDERID_RoamingAppData}/reth/` - macOS: `$HOME/Library/Application Support/reth/` - + [default: default] --chain The chain this node is running. - + Possible values are either a built-in chain or the path to a chain specification file. - + Built-in chains: - mainnet - goerli - sepolia - + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +### `reth stage unwind to-block` + +Unwinds the database until the given block number (range is inclusive) + +```bash +$ reth stage unwind to-block --help + +Usage: reth stage unwind to-block [OPTIONS] + +Arguments: + + + +Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +### `reth stage unwind num-blocks` + +Unwinds the given number of blocks from the database + +```bash +$ reth stage unwind num-blocks --help + +Usage: reth stage unwind num-blocks [OPTIONS] + +Arguments: + + + +Options: + --datadir + The path to the data dir for all reth files and subdirectories. + + Defaults to the OS-specific data directory: + + - Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/` + - Windows: `{FOLDERID_RoamingAppData}/reth/` + - macOS: `$HOME/Library/Application Support/reth/` + + [default: default] + + --chain + The chain this node is running. + + Possible values are either a built-in chain or the path to a chain specification file. + + Built-in chains: + - mainnet + - goerli + - sepolia + + [default: mainnet] + + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` diff --git a/book/cli/test-vectors.md b/book/cli/test-vectors.md index 4e7f9c8e7..68ada830f 100644 --- a/book/cli/test-vectors.md +++ b/book/cli/test-vectors.md @@ -1,16 +1,97 @@ # `reth test-vectors` +Generate Test Vectors + ```bash $ reth test-vectors --help -Generate Test Vectors -Usage: reth test-vectors +Usage: reth test-vectors [OPTIONS] Commands: tables - Generates test vectors for specified tables. If no table is specified, generate for all. + Generates test vectors for specified tables. If no table is specified, generate for all + help + Print this message or the help of the given subcommand(s) + +Options: + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output +``` + +## `reth test-vectors tables` + +Generates test vectors for specified tables. If no table is specified, generate for all + +```bash +$ reth test-vectors tables --help + +Usage: reth test-vectors tables [OPTIONS] [NAMES]... Arguments: - - List of table names. Case-sensitive. + [NAMES]... + List of table names. Case-sensitive + +Options: + -h, --help + Print help (see a summary with '-h') + +Logging: + --log.persistent + The flag to enable persistent logs + + --log.directory + The path to put log files in + + [default: /reth/logs] + + --log.journald + Log events to journald + + --log.filter + The filter to use for logs written to the log file + + [default: error] + +Display: + -v, --verbosity... + Set the minimum log level. + + -v Errors + -vv Warnings + -vvv Info + -vvvv Debug + -vvvvv Traces (warning: very verbose!) + + -q, --quiet + Silence all log output ``` diff --git a/book/cli/update.sh b/book/cli/update.sh new file mode 100755 index 000000000..ca7722e3f --- /dev/null +++ b/book/cli/update.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +# Define the build path. +build_path=$1 +if [ -z "$build_path" ]; then + echo "Build path variable is not defined. Exiting..." + exit 1 +fi +reth_path=./$build_path/debug/reth +echo "Using reth path: $reth_path (build path: $build_path)" + +# Define the path to the JSON configuration file. +json_file="./book/cli/config.json" +echo "Using config file: $json_file" + +# Read commands from JSON configuration file. +read_cmds_from_json() { + local json_file="$1" + jq -r '.commands | keys[]' "$json_file" +} + +# Read subcommands for a given command from JSON configuration file. +read_subcmds_from_json() { + local json_file="$1" + local cmd="$2" + jq -r ".commands[\"$cmd\"] | if type == \"object\" then keys[] else .[] end" "$json_file" +} + +# Read subsubcommands for a given command and subcommand from JSON configuration file. +read_subsubcmds_from_json() { + local json_file="$1" + local cmd="$2" + local subcmd="$3" + jq -r ".commands[\"$cmd\"][\"$subcmd\"][]" "$json_file" +} + +# Update the main documentation. +update_main_doc() { + local file_path="./book/cli/cli.md" + local cmd_help_output=$($reth_path --help) + sed -i -e '/## Commands/,$d' "$file_path" + cat >> "$file_path" << EOF +## Commands + +\`\`\`bash +$ reth --help +$cmd_help_output +\`\`\` +EOF +} + +# Update any `reth` command documentation. +update_cli_cmd() { + local cmd="$1" + local subcmds=("${@:2}") + echo "reth $cmd" + + local cmd_help_output=$($reth_path "$cmd" --help) + local description=$(echo "$cmd_help_output" | head -n 1) + cat > "./book/cli/$cmd.md" << EOF +# \`reth $cmd\` + +$(if [[ -n "$description" ]]; then echo "$description"; fi) + +\`\`\`bash +$ reth $cmd --help +$(echo "$cmd_help_output" | sed '1d') +\`\`\` +EOF + + for subcmd in "${subcmds[@]}"; do + echo " ├── $subcmd" + + local subcmd_help_output=$($reth_path "$cmd" "$subcmd" --help) + local subcmd_description=$(echo "$subcmd_help_output" | head -n 1) + cat >> "book/cli/$cmd.md" << EOF + +## \`reth $cmd $subcmd\` + +$(if [[ -n "$subcmd_description" ]]; then echo "$subcmd_description"; fi) + +\`\`\`bash +$ reth $cmd $subcmd --help +$(echo "$subcmd_help_output" | sed '1d') +\`\`\` +EOF + + # Read subsubcommands and update documentation + subsubcmds=($(read_subsubcmds_from_json "$json_file" "$cmd" "$subcmd")) + for subsubcmd in "${subsubcmds[@]}"; do + echo " ├── $subsubcmd" + + local subsubcmd_help_output=$($reth_path "$cmd" "$subcmd" "$subsubcmd" --help) + local subsubcmd_description=$(echo "$subsubcmd_help_output" | head -n 1) + cat >> "book/cli/$cmd.md" << EOF + +### \`reth $cmd $subcmd $subsubcmd\` + +$(if [[ -n "$subsubcmd_description" ]]; then echo "$subsubcmd_description"; fi) + +\`\`\`bash +$ reth $cmd $subcmd $subsubcmd --help +$(echo "$subsubcmd_help_output" | sed '1d') +\`\`\` +EOF + done + done +} + +# Update the book CLI documentation. +main() { + update_main_doc + + # Update commands doc. + cmds=($(read_cmds_from_json "$json_file")) + for cmd in "${cmds[@]}"; do + subcmds=($(read_subcmds_from_json "$json_file" "$cmd")) + update_cli_cmd "$cmd" "${subcmds[@]}" + done + + # Update default paths on both Linux and macOS to avoid triggering the CI. + sed -i -e 's/default: \/.*\/reth\//default: \/reth\//g' ./book/cli/*.md + rm ./book/cli/*.md-e + + echo "Book updated successfully." +} + +main