Optimism 백서

Optimism

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 65쪽

gs, metrics, and observability # Configure RPC Trust Source: https://docs.optimism.io/node-operators/kona-node/run/rpc-trust Decide when to enable RPC response verification on kona-node and configure the --l1-trust-rpc and --l2-trust-rpc flags for trusted and untrusted providers. The `--l1-trust-rpc` and `--l2-trust-rpc` flags control whether Kona performs additional verification on RPC responses to protect against malicious or faulty RPC providers. This guide helps you choose the right setting for your infrastructure and shows how to configure it. ## Trust Modes **Default Behavior (trust enabled, `true`):** * No additional block hash verification is performed * Optimized for performance * Suitable for local nodes and trusted infrastructure * Assumes the RPC provider is reliable and honest **Verification Mode (trust disabled, `false`):** * All fetched blocks have their hashes verified against the requested hashes * Protects against malicious RPC providers returning incorrect blocks * Recommended for public or third-party RPC endpoints * Small performance overhead due to hash verification ## Examples **Using trusted local RPCs (default):** ```bash theme={null} kona-node node \ --l1-eth-rpc http://localhost:8545 \ --l2-engine-rpc http://localhost:8551 \ # trust-rpc defaults to true, no need to specify ``` **Using untrusted public RPCs:** ```bash theme={null} kona-node node \ --l1-eth-rpc https://public-eth-rpc.com \ --l1-trust-rpc false \ --l2-engine-rpc https://public-l2-rpc.com \ --l2-trust-rpc false ``` **Mixed trust configuration:** ```bash theme={null} kona-node node \ --l1-eth-rpc https://public-eth-rpc.com \ --l1-trust-rpc false \ --l2-engine-rpc http://localhost:8551 \ # L2 trust-rpc defaults to true for local engine ``` ## Security Recommendations 1. **Local Infrastructure**: Keep the default `true` setting for RPCs you control 2. **Public RPCs**: Always set `--trust-rpc false` when using third-party endpoints 3. **Shared Infrastructure**: Consider setting `--trust-rpc false` as a precaution 4. **Performance Testing**: The verification overhead is minimal but can be measured in high-throughput scenarios ## Next Steps * Both flags are catalogued with the rest of the node's options in the [Kona node CLI reference](/node-operators/kona-node/configuration). * To get a node running end to end, follow the [binary guide](/node-operators/kona-node/run/binary) or the [Docker guide](/node-operators/kona-node/run/docker). # Run a Sequencer Node Source: https://docs.optimism.io/node-operators/kona-node/run/sequencer Run kona-node in sequencer mode from the command line, including required arguments, sequencer-specific flags, and example configurations. This guide shows how to run `kona-node` in **sequencer mode** from the command line. For how sequencer mode works internally and how to configure it programmatically through the Node SDK, see the [sequencer mode design](/node-operators/kona-node/design/sequencer) page. <Info> Sequencer mode is an advanced configuration primarily used by rollup operators. Most users will run nodes in the default validator mode. </Info> ## Basic Sequencer Setup To run a Kona node in sequencer mode: ```bash theme={null} kona-node node \ --mode=Sequencer \ --l1-eth-rpc=http://l1-node:8545 \ --l1-beacon=http://l1-beacon:5052 \ --l2-engine-rpc=http://l2-execution:8551 \ --l2.jwt-secret=./jwt.hex \ --p2p.sequencer.key.path=./p2p-sequencer.key \ --chain=123456 ``` ## Required Arguments <Warning> **Required Configuration** Sequencer mode requires all standard node arguments plus the `--mode=Sequencer` flag and a block signer. Missing any required argument will prevent the node from starting. </Warning> | Argument | Flag | Environment Variable | Description | | - | - | - | - | | **Mode** | `--mode` | `KONA_NODE_MODE` | Must be set to `Sequencer` | | **L1 RPC** | `--l1-eth-rpc` | `KONA_NODE_L1_ETH_RPC` | L1 execution client RPC URL | | **L1 Beacon** | `--l1-beacon` | `KONA_NODE_L1_BEACON` | L1 beacon API URL | | **L2 Engine** | `--l2-engine-rpc` | `KONA_NODE_L2_ENGINE_RPC` | L2 engine API endpoint | | **JWT Secret** | `--l2.jwt-secret` | `KONA_NODE_L2_ENGINE_AUTH` | Path to JWT secret file | | **Chain ID** | `--chain` | `KONA_NODE_L2_CHAIN_ID` | L2 chain identifier | | **Block Signer** | `--p2p.sequencer.key.path`, `--p2p.sequencer.key`, or `--p2p.signer.endpoint` with `--p2p.signer.address` | `KONA_NODE_P2P_SEQUENCER_KEY_PATH`, `KONA_NODE_P2P_SEQUENCER_KEY`, `KONA_NODE_P2P_SIGNER_ENDPOINT`, `KONA_NODE_P2P_SIGNER_ADDRESS` | Signs the blocks the sequencer gossips: a local key, or a remote op-signer | ## Sequencer-Specific Flags | Flag | Environment Variable | Default | Description | | - | - | - | - | | `--sequencer.stopped` | `KONA_NODE_SEQUENCER_STOPPED` | `false` | Start sequencer in stopped state | | `--sequencer.max-safe-lag` | `KONA_NODE_SEQUENCER_MAX_SAFE_LAG` | `0` | Max L2 blocks between safe and unsafe heads | | `--sequencer.l1-confs` | `KONA_NODE_SEQUENCER_L1_CONFS` | `4` | L1 confirmations for origin selection | | `--sequencer.recover` | `KONA_NODE_SEQUENCER_RECOVER` | `false` | Force recovery mode operation | | `--conductor.rpc` | `KONA_NODE_CONDUCTOR_RPC` | - | Conductor service RPC endpoint | | `--conductor.rpc.timeout` | `KONA_NODE_CONDUCTOR_RPC_TIMEOUT` | `1` | Conductor RPC timeout (seconds) | The full flag catalogue, including the standard node arguments shared with validator mode, lives in the [Kona node CLI reference](/node-operators/kona-node/configuration). ## Example Configurations ### Basic Sequencer ```bash theme={null} kona-node node \ --mode=Sequencer \ --l1-eth-rpc=http://localhost:8545 \ --l1-beacon=http://localhost:5052 \ --l2-engine-rpc=http://localhost:8551 \ --p2p.sequencer.key.path=./p2p-sequencer.key \ --chain=42161 ``` ### Sequencer with Conductor ```bash theme={null} kona-node node \ --mode=Sequencer \ --conductor.rpc=http://conductor:8080 \ --conductor.rpc.timeout=5 \ --sequencer.l1-confs=6 \ --l1-eth-rpc=http://l1-node:8545 \ --l1-beacon=http://l1-beacon:5052 \ --l2-engine-rpc=http://l2-execution:8551 \ --p2p.sequencer.key.path=./p2p-sequencer.key \ --chain=123456 ``` ### Recovery Mode Sequencer ```bash theme={null} kona-node node \ --mode=Sequencer \ --sequencer.recover=true \ --sequencer.max-safe-lag=100 \ --l1-eth-rpc=http://localhost:8545 \ --l1-beacon=http://localhost:5052 \ --l2-engine-rpc=http://localhost:8551 \ --p2p.sequencer.key.path=./p2p-sequencer.key \ --chain=42161 ``` ## Key Considerations <Tip> **Sequencer Operation** * **L1 Confirmations**: The `--sequencer.l1-confs` setting determines how many L1 blocks the sequencer waits before using an L1 block as an origin. Higher values provide more safety but increase latency. * **Recovery Mode**: Use `--sequencer.recover=true` when the sequencer needs to catch up after being offline. * **Conductor Integration**: For multi-sequencer deployments, configure the conductor service for proper leader election. </Tip> Running a sequencer in production requires careful consideration of infrastructure, monitoring, and failover procedures. Ensure proper JWT secret management and secure network configuration. # `kona-node` Subcommands Source: https://docs.optimism.io/node-operators/kona-node/subcommands Below are the available subcommands for `kona-node`: * **node**: Runs the main consensus node service. This is the primary subcommand for operating a rollup node. * **info**: Displays information about the node, build, and environment. * **bootstore**: Manages the P2P bootstore (used for peer discovery and persistence). * **net**: Provides network-related utilities and diagnostics. * **registry**: Interacts with the chain registry for configuration and metadata. For more details on each subcommand and their flags, run: ``` kona-node <subcommand> --help ``` # op-reth Source: https://docs.optimism.io/node-operators/op-reth/cli/op-reth Reth ```bash theme={null} $ op-reth --help ``` ```txt theme={null} Usage: op-reth [OPTIONS] <COMMAND> Commands: node Start the node init Initialize the database from a genesis file init-state Initialize the database from a state dump file import-op This syncs RLP encoded OP blocks below Bedrock from a file, without executing import-receipts-op This imports RLP encoded receipts from a file dump-genesis Dumps genesis block JSON configuration to stdout db Database debugging utilities stage Manipulate individual stages p2p P2P Debugging utilities config Write config to stdout prune Prune according to the configuration without any limits re-execute Re-execute blocks in parallel to verify historical sync correctness proofs Manage storage of historical proofs in expanded trie db in fault proof window help Print this message or the help of the given subcommand(s) Options: -h, --help Print help (see a summary with '-h') -V, --version Print version Logging: --log.stdout.format <FORMAT> The format to use for logs written to stdout Possible values: - json: Represents JSON formatting for logs. This format outputs log records as JSON objects, making it suitable for structured logging - log-fmt: Represents logfmt (key=value) formatting for logs. This format is concise and human-readable, typically used in command-line applications - terminal: Represents terminal-friendly formatting for logs [default: terminal] --log.stdout.filter <FILTER> The filter to use for logs written to stdout [default: ""] --log.file.format <FORMAT> The format to use for logs written to the log file Possible values: - json: Represents JSON formatting for logs. This format outputs log records as JSON objects, making it suitable for structured logging - log-fmt: Represents logfmt (key=value) formatting for logs. This format is concise and human-readable, typically used in command-line applications - terminal: Represents terminal-friendly formatting for logs [default: terminal] --log.file.filter <FILTER> The filter to use for logs written to the log file [default: debug] --log.file.directory <PATH> The path to put log files in [default: <CACHE_DIR>/logs] --log.file.name <NAME> The prefix name of the log files [default: reth.log] --log.file.max-size <SIZE> The maximum size (in MB) of one log file [default: 200] --log.file.max-files <COUNT> The maximum amount of log files that will be stored. If set to 0, background file logging is disabled. Default: 5 for `node` command, 0 for non-node utility subcommands. --log.journald Write logs to journald --log.journald.filter <FILTER> The filter to use for logs written to journald [default: error] --color <COLOR> Sets whether or not the formatter emits ANSI terminal escape codes for colors and other text formatting Possible values: - always: Colors on - auto: Auto-detect - never: Colors off [default: always] --logs-otlp[=<URL>] Enable `Opentelemetry` logs export to an OTLP endpoint. If no value provided, defaults based on protocol: - HTTP: `http://localhost:4318/v1/logs` - gRPC: `http://localhost:4317` Example: --logs-otlp=http://collector:4318/v1/logs [env: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=] --logs-otlp.filter <FILTER> Set a filter directive for the OTLP logs exporter. This controls the verbosity of logs sent to the OTLP endpoint. It follows the same syntax as the `RUST_LOG` environment variable. Example: --logs-otlp.filter=info,reth=debug Defaults to INFO if not specified. [default: info] 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 Tracing: --tracing-otlp[=<URL>] Enable `Opentelemetry` tracing export to an OTLP endpoint. If no value provided, defaults based on protocol: - HTTP: `http://localhost:4318/v1/traces` - gRPC: `http://localhost:4317` Example: --tracing-otlp=http://collector:4318/v1/traces [env: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=] --tracing-otlp-protocol <PROTOCOL> OTLP transport protocol to use for exporting traces and logs. - `http`: expects endpoint path to end with `/v1/traces` or `/v1/logs` - `grpc`: expects endpoint without a path Defaults to HTTP if not specified. Possible values: - http: HTTP/Protobuf transport, port 4318, requires `/v1/traces` path - grpc: gRPC transport, port 4317 [env: OTEL_EXPORTER_OTLP_PROTOCOL=] [default: http] --tracing-otlp.filter <FILTER> Set a filter directive for the OTLP tracer. This controls the verbosity of spans and events sent to the OTLP endpoint. It follows the same syntax as the `RUST_LOG` environment variable. Example: --tracing-otlp.filter=info,reth=debug,hyper_util=off Defaults to TRACE if not specified. [default: debug] --tracing-otlp.sample-ratio <RATIO> Trace sampling ratio to control the percentage of traces to export. Valid range: 0.0 to 1.0 - 1.0, default: Sample all traces - 0.01: Sample 1% of traces - 0.0: Disable sampling Example: --tracing-otlp.sample-ratio=0.0. [env: OTEL_TRACES_SAMPLER_ARG=] ``` # op-reth config Source: https://docs.optimism.io/node-operators/op-reth/cli/op-reth/config Write config to stdout ```bash theme={null} $ op-reth config --help ``` ```txt theme={null} Usage: op-reth config [OPTIONS] Options: --config <FILE> The path to the configuration file to use. --default Show the default config -h, --help Print help (see a summary with '-h') Logging: --log.stdout.format <FORMAT> The format to use for logs written to stdout Possible values: - json: Represents JSON formatting for logs. This format outputs log records as JSON objects, making it suitable for structured logging - log-fmt: Represents logfmt (key=value) formatting for logs. This format is concise and human-readable, typically used in command-line applications - terminal: Represents terminal-friendly formatting for logs [default: terminal] --log.stdout.filter <FILTER> The filter to use for logs written to stdout [default: ""] --log.file.format <FORMAT> The format to use for logs written to the log file Possible values: - json: Represents JSON formatting for logs. This format outputs log records as JSON objects, making it suitable for structured logging - log-fmt: Represents logfmt (key=value) formatting for logs. This format is concise and human-readable, typically used in command-line applications - terminal: Represents terminal-friendly formatting for logs [default: terminal] --log.file.filter <FILTER> The filter to use for logs written to the log file [default: debug] --log.file.directory <PATH> The path to put log files in [default: <CACHE_DIR>/logs] --log.file.name <NAME> The prefix name of the log files [default: reth.log] --log.file.max-size <SIZE> The maximum size (in MB) of one log file [default: 200] --log.file.max-files <COUNT> The maximum amount of log files that will be stored. If set to 0, background file logging is disabled. Default: 5 for `node` command, 0 for non-node utility subcommands. --log.journald Write logs to journald --log.journald.filter <FILTER> The filter to use for logs written to journald [default: error] --color <COLOR> Sets whether or not the formatter emits ANSI terminal escape codes for colors and other text formatting Possible values: - always: Colors on - auto: Auto-detect - never: Colors off [default: always] --logs-otlp[=<URL>] Enable `Opentelemetry` logs export to an OTLP endpoint. If no value provided, defaults based on protocol: - HTTP: `http://localhost:4318/v1/logs` - gRPC: `http://localhost:4317` Example: --logs-otlp=http://collector:4318/v1/logs [env: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=] --logs-otlp.filter <FILTER> Set a filter directive for the OTLP logs exporter. This controls the verbosity of logs sent to the OTLP endpoint. It follows the same syntax as the `RUST_LOG` environment variable. Example: --logs-otlp.filter=info,reth=debug Defaults to INFO if not specified. [default: info] 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 Tracing: --tracing-otlp[=<URL>] Enable `Opentelemetry` tracing export to an OTLP endpoint. If no value provided, defaults based on protocol: - HTTP: `http://localhost:4318/v1/traces` - gRPC: `http://localhost:4317` Example: --tracing-otlp=http://collector:4318/v1/traces [env: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=] --tracing-otlp-protocol <PROTOCOL> OTLP transport protocol to use for exporting traces and logs. - `http`: expects endpoint path to end with `/v1/traces` or `/v1/logs` - `grpc`: expects endpoint without a path Defaults to HTTP if not specified. Possible values: - http: HTTP/Protobuf transport, port 4318, requires `/v1/traces` path - grpc: gRPC transport, port 4317 [env: OTEL_EXPORTER_OTLP_PROTOCOL=] [default: http] --tracing-otlp.filter <FILTER> Set a filter directive for the OTLP tracer. This controls the verbosity of spans and events sent to the OTLP endpoint. It follows the same syntax as the `RUST_LOG` environment variable. Example: --tracing-otlp.filter=info,reth=debug,hyper_util=off Defaults to TRACE if not specified. [default: debug] --tracing-otlp.sample-ratio <RATIO> Trace sampling ratio to control the percentage of traces to export. Valid range: 0.0 to 1.0 - 1.0, default: Sample all traces - 0.01: Sample 1% of traces - 0.0: Disable sampling Example: --tracing-otlp.sample-ratio=0.0. [env: OTEL_TRACES_SAMPLER_ARG=] ``` # op-reth db Source: https://docs.optimism.io/node-operators/op-reth/cli/op-reth/db Database debugging utilities ```bash theme={null} $ op-reth db --help ``` ```txt theme={null} Usage: op-reth db [OPTIONS] <COMMAND> Commands: stats Lists all the tables, their entry count and their size list Lists the contents of a table checksum Calculates the content checksum of a table or static file segment copy Copies the MDBX database to a new location (bundled mdbx_copy) diff Create a diff between two database tables or two entire databases get Gets the content of a table for the given key drop Deletes all database entries clear Deletes all table entries repair-trie Verifies trie consistency and outputs any inconsistencies static-file-header Reads and displays the static file segment header version Lists current and local database versions path Returns the full database path settings Manage storage settings prune-checkpoints View or set prune checkpoints stage-checkpoints `reth db stage-checkpoints` subcommand account-storage Gets storage size information for an account state Gets account state and storage at a specific block migrate-v2 Migrate storage layout from v1 (MDBX-only) to v2 (static files + RocksDB) help Print this message or the help of the given subcommand(s) Options: -h, --help Print help (see a summary with '-h') Datadir: --datadir <DATA_DIR> 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] --datadir.static-files <PATH> The absolute path to store static files in. --datadir.rocksdb <PATH> The absolute path to store `RocksDB` database in. --datadir.pprof-dumps <PATH> The absolute path to store pprof dumps in. --config <FILE> The path to the configuration file to use --chain <CHAIN_OR_PATH> 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: optimism, op-mainnet, optimism_sepolia, optimism-sepolia, automata, bob, boba, celo, cyber, ethernity, fraxtal, funki, hashkeychain, ink, lisk, lyra, metal, mint, mode, op, orderly, poly
프로젝트로 돌아가기