From 1a6e36b999fe7cd592da5d942a68cb02960c0578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20R=2E=20Bald=C3=A9?= Date: Fri, 21 Feb 2025 01:26:03 +0000 Subject: [PATCH] Update `README` regarding storage related features (#887) * Add note regarding `--db/db:` * Add note regarding `--resume/resume:` --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2753a784..aff03f0b 100644 --- a/README.md +++ b/README.md @@ -302,9 +302,16 @@ await check(data) ### Resuming Network State with `--resume` -When testing complex scenarios, especially with XCM interactions between networks, you may want to persist and resume network states. The `--resume` feature allows you to resume from a specific block hash, block number, or the latest block in the database. +When testing complex scenarios, especially with XCM interactions between networks, you may want to persist and resume +network states. +The `--resume` feature, used in a single chain scenario, allows you to resume from a specific block hash, block number, +or the latest block in the database. -Each network in an XCM setup can have its own database path specified in its config file. This allows independent state persistence and resumption for each network. +Each network in an XCM setup can have its own database path specified in its config file. This allows independent state +persistence and resumption for each network. + +In a multiple chain scenario, use a `resume:` key in the chain's `.yml` config with the hash/number of the block at +which each chain is to resume. #### Configuration Examples @@ -322,14 +329,25 @@ db: ./db-polkadot.sqlite # Must be a different path from other networks #### Using with XCM Setup -When connecting multiple networks with XCM, each can have its own database: +When connecting multiple networks with XCM, each can have its own database from which to resume: + +```yaml +# configs/polkadot.yml +... +db: +resume: | +... + +# configs/acala.yml +db: +resume: | +``` ```bash # Start XCM setup with custom database paths npx @acala-network/chopsticks@latest xcm \ -r configs/polkadot.yml \ - -p configs/acala.yml \ - --resume + -p configs/acala.yml ``` ### Single network resumption @@ -379,6 +397,9 @@ The subcommand arguments could be: Please note that for both ways, fetched storages will be saved in the sqlite file specified by `--db` option (`db: ./acala.sqlite` in a config file), if not provided, it will default to `./db-{network}-{block}.sqlite`. +In a multi-chain scenario, do not pass `--db` flags to each chain, and instead insert a `db:` key in each config with +the appropriate value. + ## Try-Runtime CLI Documentation can be found [here](packages/chopsticks/src/plugins/try-runtime/README.md)