Skip to content

Commit

Permalink
Update README regarding storage related features (#887)
Browse files Browse the repository at this point in the history
* Add note regarding `--db/db:`

* Add note regarding `--resume/resume:`
  • Loading branch information
rockbmb authored Feb 21, 2025
1 parent dbc1cc0 commit 1a6e36b
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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: <db-filepath>
resume: <block-number> | <block-hash>
...

# configs/acala.yml
db: <db-filepath>
resume: <block-number> | <block-hash>
```
```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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1a6e36b

Please sign in to comment.