Monad 백서

Monad

원문

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

eing scattered independently across disk by hashing. For node operators, what matters is that this changes the on-disk trie layout — which is why a migration is required. ### TrieDB timelines A **timeline** is a full copy of the trie state on disk, built by writing every committed block into it in a given encoding. A node can run one or two timelines at once, each in its own encoding: * **Slot-encoded timeline** uses the current trie layout, where each storage slot's disk location is determined independently by hashing. This is the pre-MIP-8 format. * **Page-encoded timeline** uses the MIP-8 layout, where slots are packed into pages of 128 consecutive slots. This is the post-MIP-8 format. **Dual mode** is a transitional state where a node runs both encodings at once, as two timelines on disk, and writes every committed block to both. A node stays in dual mode for the whole window between activating the page timeline and decommissioning the slot timeline. **Primary** and **secondary** just label the two timelines on disk. They have no effect on execution or consensus. Over the course of the migration, primary and secondary swap, then the secondary is dropped (see [Migration plan](#migration-plan)). ### State machine kinds The node's database tooling (`monad-mpt`, `monad-cli`) refers to slot and page encoding as state-machine kinds: | Kind on CLI | Encoding | | - | - | | `ethereum` | slot | | `monad` | page | What matters for execution is which timeline is **canonical** versus **shadow**. The canonical timeline is the one whose `state_root` is used for blocks on the canonical chain; the shadow timeline computes the same blocks on the other encoding in parallel, without its `state_root` being used anywhere. MIP-8 activation is exactly the flip between the two: * before activation, `ethereum` (slot) is canonical and `monad` (page) is the shadow * this swaps at the hard fork, `monad` (page) becomes canonical and `ethereum` (slot) becomes the shadow. This is why activation happens by network-wide consensus. ## Migration plan The migration runs in three phases: two operator actions and one hard fork. Phase A activates the page timeline on each node. Phase B is the MIP-8 hard fork: at a fixed timestamp, the canonical chain switches from the slot timeline to the page timeline. Phase C decommissions the now-legacy slot timeline. <img /> <Steps> <Step title="Initial"> DB mode is Legacy/Slot — a single slot timeline. Execution is Pre MIP-8 Activation. </Step> <Step title="Phase A — Page activation"> Operators activate the page secondary, bringing DB mode to Dual. Execution is still Pre MIP-8 Activation — nothing changes at the execution level yet. </Step> <Step title="Phase B — Hard fork"> At the fork timestamp, MIP-8 activates network-wide: the page timeline becomes canonical and the slot timeline becomes its shadow. The node stays in Dual mode. </Step> <Step title="Phase C — Slot decommission (Final)"> Operators promote the page timeline as primary, and decommission the now secondary slot timeline. DB mode flips to Page — a single page timeline. The node is now fully migrated. </Step> </Steps> ## Operations ### Network status | Network | Phase | Hard fork timestamp | MIP-8 activated | | - | - | - | - | | Testnet | Complete | `1786545000` (2026-08-12 14:30 UTC) | Yes | | Mainnet | Phase-C | `1788359400` (2026-09-02 14:30 UTC) | Yes | ### Get the current status Check a node's current on-disk state directly with `monad-mpt`: ```bash theme={null} monad-mpt --storage /dev/triedb ``` **Legacy/Slot** — migration not started: ``` Active timelines: Primary: State machine kind: ethereum ``` **Dual** — migration in progress: ``` Active timelines: Primary: State machine kind: ethereum Secondary: State machine kind: monad ``` **Page** — migration complete: ``` Active timelines: Primary: State machine kind: monad ``` ### Prometheus Metrics You can monitor the dual-DB migration phase via the Prometheus metric `monad_triedb_migration_phase`: * `0`: slot-encoded (expected value during Init phase) * `1`: dual-mode (expected value during Phase A and Phase B) * `2`: page-encoded (expected value during Phase C) ### Monad Status The [`monad-status`](/node-ops/general-operations#node-status-with-monad-status) script has been updated to reflect the TrieDB mode, e.g.: ```yq theme={null} triedb: model: SAMSUNG MZQL21T9HCJR-00A07 device: nvme0n1p1 mode: dual-timeline timelines: primary: ethereum secondary: monad ``` ### Hard reset a node The hard reset process itself doesn't change — still follow the [Hard Reset Instructions](/node-ops/node-recovery/hard-reset). The DB mode logic below happens automatically inside that same `restore-from-snapshot` step; there's no new manual procedure to learn. A hard reset doesn't migrate your existing database — it wipes it and rebuilds from a snapshot. That means the reset tooling can't look at your node's prior on-disk state to decide what to rebuild (the reset truncates the DB before anything else runs), so it picks the target DB mode with this logic: * If the MIP-8 hard fork has already passed, it creates a page timeline only, and imports the snapshot into it. * If the fork hasn't passed yet and it can also create a page timeline, the result is Dual mode, with the snapshot imported into both timelines. * If the fork hasn't passed yet and it can't create a page timeline, the result is Legacy/Slot, with the snapshot imported into the slot timeline only. | MIP-8 Activation timestamp | Page timeline creation supported | Resulting DB mode | | - | - | - | | MIP-8 Active | — | Page | | Inactive | Yes | Dual | | Inactive | No | Legacy/Slot | The first row is deliberate: once MIP-8 is active on the network, there's no reason to stand up a slot timeline just to decommission it again in the very next phase — a reset node goes straight to page-only. ## Migration tasks This applies to both full nodes and validators. The migration runs in three phases. Phases A and C are actions you take on each node; phase B is a network-wide hard fork that happens on a schedule. ### Phase A - Page activation <Warning> **Do not run this procedure. Wait for the official Monad Foundation announcement.** **Validators migration will occur in cohorts.** Ensure you know which cohort you are in, and only action these steps when your cohort is announced. Deployment dates and cohorts will be communicated via official channels. </Warning> This process is supported starting from `0.15.2`. This step uses the new `monad-mpt` and `monad-cli` binaries starting from this version. **Stop the monad services:** ```bash theme={null} sudo systemctl stop monad-bft monad-execution monad-rpc ``` The snapshot dump will open many file descriptors (8 per shard). If your system's open-file limit is at the default 1024, the dump will crash. **Raise the limit before running:** ```bash theme={null} ulimit -n 65536 ``` **Prepare the snapshot folder and clean up any pre-existing secondary timeline:** ```bash theme={null} SNAP_DIR="/home/monad/monad-bft/snapshots/page-migration" rm -rf "$SNAP_DIR" && mkdir -p "$SNAP_DIR" monad-mpt --storage /dev/triedb --deactivate-secondary || true ``` **Activate the secondary timeline:** ```bash theme={null} monad-mpt --storage /dev/triedb --repair monad-mpt --storage /dev/triedb --activate-secondary --state-machine monad ``` Expected output: `Activated secondary timeline; stamped state-machine kind to monad.` **Dump a snapshot of the current primary:** ```bash theme={null} monad-cli --db /dev/triedb --version latest_finalized --dump-binary-snapshot "$SNAP_DIR" ``` Expected output: `snapshot dump success=true`. Takes approximately 5 minutes. **Load the snapshot into the page secondary:** ```bash theme={null} monad-cli --db /dev/triedb --version latest_finalized --load-binary-snapshot "$SNAP_DIR" --secondary ``` Expected output: `load_to_secondary=true`. Takes approximately 3 minutes. **Clean up the snapshot:** ```bash theme={null} rm -rf "$SNAP_DIR" ``` **Verify the status of TrieDB:** ```bash theme={null} monad-mpt --storage /dev/triedb ``` The command should print output similar to the following: ```text theme={null} Active timelines: Primary: State machine kind: ethereum History: 19513 versions, earliest is 47516671, latest is 47536183 Auto expire version: 47516671 Secondary: State machine kind: monad History: 256 versions, earliest is 47535928, latest is 47536183 Auto expire version: 47535929 ``` Verify that the `latest` values for both timelines are close (`47536183` in this example): * Primary: `latest is 47536183` * Secondary: `latest is 47536183` A difference of a few blocks (up to \~10) is normal. **Start the Monad services:** ```bash theme={null} sudo systemctl start monad-bft monad-execution monad-rpc sudo systemctl status monad-bft monad-execution monad-rpc --no-pager -l ``` All services should show Active: `active (running)`. Confirm the node rejoins and advances blocks. Once complete, the node is in dual-write mode — it will commit every new block to both timelines on next start. The `monad-execution` logs would print `state_root primary=<slot root> secondary=<page root>`, both timelines should appear for each block. Run this on every node to bring the node into dual mode. Every node must complete this phase before the MIP-8 hard fork timestamp. ### Phase B - MIP-8 Hardfork **MIP-8 activation** Phase B is a scheduled protocol upgrade, not an operator action. Its timestamp is encoded in a chain-wide release and is identical for every node — it only ships once the whole network has completed phase A. At that timestamp, MIP-8 activates at the execution level and the canonical `state_root` flips from the slot timeline to the page timeline, network-wide, in the same block: * **Before the fork** — the slot timeline is canonical; the page timeline shadows it. * **At and after the fork** — the page timeline is canonical; the slot timeline shadows it. Which timeline is on-disk primary is independent of which one is canonical. ### Phase C - Slot decommission This phase will decommission the slot timeline in the TrieDB. This action can be done only after the MIP-8 activation hard fork timestamp. <Warning> **Validators migration will occur in cohorts.** Ensure you know which cohort you are in, and only action these steps when your cohort is announced. Deployment dates and cohorts will be communicated via official channels. </Warning> <Warning> **State Archive nodes** State Archive nodes do not run this phase — see [State Archive nodes](#state-archive-nodes). </Warning> Also note that nodes that performed a hard reset after the MIP-8 activation timestamp would have been restored with a Page timeline only, and would not need to decommission any timelines. **Verify the node needs this phase:** ```bash theme={null} monad-mpt --storage /dev/triedb ``` Expected output: ```text theme={null} Active timelines: Primary: State machine kind: ethereum Secondary: State machine kind: monad ``` Only proceed if Primary is `ethereum` (slot) and Secondary is `monad` (page). Any other combination means the node should not run this phase. **Stop the monad services:** ```bash theme={null} sudo systemctl stop monad-bft monad-execution monad-rpc ``` **Promote the page secondary to primary:** ```bash theme={null} monad-mpt --promote-secondary --storage /dev/triedb ``` **Deactivate the now-stale slot timeline, reclaiming its disk space:** ```bash theme={null} monad-mpt --deactivate-secondary --storage /dev/triedb ``` **Verify the status of TrieDB:** ```bash theme={null} monad-mpt --storage /dev/triedb ``` The command should print output similar to the following: ```text theme={null} Active timelines: Primary: State machine kind: monad ``` Only a single Primary timeline with state machine kind `monad` should remain — the slot timeline is now gone. **Start the Monad services:** ```bash theme={null} sudo systemctl start monad-bft monad-execution monad-rpc sudo systemctl status monad-bft monad-execution monad-rpc --no-pager -l ``` All services should show Active: `active (running)`. Confirm the node rejoins and advances blocks. It's now a single page timeline. Future releases of Monad will enforce having the slot-encoded timeline decommissioned. ## State Archive nodes A [State Archive node](/node-ops/archive-data/genesis-replay) (also called a historical full node) stores every block since genesis in its local TrieDB database, rather than pruning old state. This makes it a special case in the MIP-8 migration: * **Phase A** — no difference. State Archive nodes upgrade and run the Dual-DB migration the same way as any other node. * **Phase B** — at the hard fork timestamp, re-run the [Phase A](#phase-a-page-activation) procedure on State Archive nodes. This re-seeds the secondary timeline at the primary timeline's current position — a special case that only applies to State Archive nodes. * **Phase C** — **State Archive nodes do not run slot decommission.** Skip this phase: the slot-encoded timeline stays active permanently so the node keeps its full history. ## Further reading * [Engineering runbook](https://github.com/category-labs/monad/blob/max/page-store-migration-runbook/docs/page_store_migration_runbook.md) — full operator procedure, including failure handling, rollback, and guard rails * [Network info](https://docs.monad.xyz/networks.json) — current network status and fork timestamps * [MIP-8](https://monad.xyz/blog/mip-8) — the proposal behind page-aware storage * [Mipland](https://mipland.com/mip-8) — MIP-8 tracking and discussion * [MIP-8: page-ified storage state](https://forum.monad.xyz/t/mip-8-page-ified-storage-state/407) — forum discussion # Prometheus Metrics Migration Source: https://docs.monad.xyz/node-ops/upgrade-instructions/prometheus-metrics-migration Configure Monad metrics endpoint <Note> Do not run this procedure. Wait for the official Monad Foundation announcement. </Note> Monad nodes expose a native HTTP endpoint in Prometheus format. Monitoring systems can scrape this endpoint directly. <Note> Collecting node metrics through the OpenTelemetry (OTel) collector is deprecated. Use the native metrics endpoint instead. </Note> ## Default configuration Since v0.16.0, the native metrics endpoint is **enabled by default**: * **Port:** `9143/TCP`. * **Listen address:** `0.0.0.0:9143` (all IPv4 interfaces). * **Path:** `/metrics`. * **Local URL:** `http://127.0.0.1:9143/metrics`. * **Remote URL:** `http://NODE_IP:9143/metrics`. This is the implicit default configuration, in `/home/monad/monad-bft/config/node.toml`: ```toml theme={null} [metrics] enabled = true listen_addr = "0.0.0.0:9143" ``` If you have not overridden these settings, no configuration change or restart is needed to enable the endpoint. ## Configure your node ### 1. Configure the endpoint The endpoint is enabled by default, so no extra configuration is required. To confirm, edit the `node.toml` file and verify the metrics endpoint is not set as `enabled = false`. **To set up a custom port, for example, to listen on port `9144`**: ```toml theme={null} [metrics] enabled = true listen_addr = "0.0.0.0:9144" ``` **To listen on another interface, for example, if metrics are collected only by a scraper on the same host**: ```toml theme={null} [metrics] enabled = true listen_addr = "127.0.0.1:9143" ``` Then restart the `monad-bft` service to reload the configuration. ```bash theme={null} systemctl restart monad-bft systemctl status monad-bft --no-pager -l ``` ### 2. Set up the firewall Block the metrics port from the public internet and allow only approved monitoring source IPs. It is requested that validators allow the **Monad Foundation monitoring server's source IP (`84.32.32.227`)** to access their metrics endpoint. <Warning> UFW evaluates rules in order, and the first matching rule wins. The monitoring allow rule must appear **before** the general deny. </Warning> ```bash theme={null} # Remove all existing rules referencing the metrics port. for n in $(ufw status numbered | grep "9143" | grep -oP '(?<=\[)[0-9]+(?=\])' | sort -rn); do ufw --force delete "$n" done # Allow the monitoring IP source and deny by default. ufw insert 1 allow proto tcp from 84.32.32.227 to any port 9143 comment 'Monad Foundation monitoring' ufw deny 9143 comment 'Block public access to metrics port' ufw status numbered ``` If the node uses a different metrics port, replace `9143` in the commands above. Verify that the allow from `84.32.32.227` appears above the deny from `Anywhere`. ### 3. Verify the endpoint Locally, this should work: ```bash theme={null} curl http://127.0.0.1:9143/metrics ``` Expect Prometheus text output with metric samples and metadata such as `# TYPE` lines. Also, from another node on the internet, test with the node's public address to confirm the firewall is blocking external traffic: ```bash theme={null} curl http://PUBLIC_NODE_ID:9143/metrics ``` This request should fail. If it succeeds, the firewall is not blocking the metrics port as expected. ## Monad Foundation scrapping By default, Monad Foundation will scrape all active validators on their public IP address, on the default `9143` port. ### Custom port It is possible to expose the validator metrics using a custom port or custom IP address. You can set up your metrics endpoint on a different port (see above), or behind a NAT setup. To declare the custom configuration, set the optional `metrics_address` or `metrics_port` on your validator-info record. Open a pull request in [monad-developers/validator-info](https://github.com/monad-developers/validator-info) with the change. For example, merge the following fields into your validator file, keeping its other fields unchanged: ```json theme={null} { "metrics_address": "192.0.2.10", "metrics_port": 9144 } ``` Replace the example address with the IP address or hostname reachable by the monitoring server. Use a host only, without `http://`, a port, or `/metrics`; specify the port separately as an integer. Do not use `0.0.0.0` as `metrics_address`: it is a local bind address, not a scrape destination. The reachable address does not have to be the node's own IP. The endpoint can be exposed through NAT redirection — a firewall or load balancer that forwards a custom public IP and port to the node's `listen_addr` — in which case `metrics_address` and `metrics_port` must match that public-facing IP and port, not the node's internal bind address. ### Confirming MF connects To confirm Monad Foundation is actively scraping your metrics endpoint, check both sides of the connection. To see the MF monitoring server's requests coming in: ```bash theme={null} tcpdump -nn -i any src host 84.32.32.227 and dst port 9143 ``` To see your node sending metrics back: ```bash theme={null} tcpdump -nn -i any src port 9143 and dst host 84.32.32.227 ``` The second command is the stronger signal: seeing packets there means the node actually responded to the scrape, not just that a request came in. ## Related instructions * [v0.16.0 upgrade instructions](./v0.16.0.mdx): configuration rename and metrics defaults. * [v0.16.1 upgrade instructions](./v0.16.1.mdx): confirmation of the default endpoint for mainnet and testnet operators. # v0.12.3 Source: https://docs.monad.xyz/node-ops/upgrade-instructions/v0.12.3 <Warning> Please do not proceed until Monad Foundation provides notice. </Warning> ## Instructions for node operators ### 1. SSH into the node as `monad` user ### 2. Upgrade monad package <Tabs> <Tab title="Mainnet"> ```bash theme={null} sudo apt update && sudo apt install --reinstall monad=0.12.3 -y --allow-downgrades --allow-change-held-packages ``` </Tab> <Tab title="Testnet"> ```bash theme={null} sudo apt update && sudo apt install --reinstall monad=0.12.3~rc.2 -y --all
프로젝트로 돌아가기