Skip to content

Commit

Permalink
Add Docker dumping docs (#489)
Browse files Browse the repository at this point in the history
* [skip ci]
  • Loading branch information
FabijanC authored Jun 10, 2024
1 parent 93317d6 commit e68a44a
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 4 deletions.
4 changes: 2 additions & 2 deletions website/docs/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Response:

## Create an empty block

To create an empty block without transactions, `POST` a request to /create_block:
To create an empty block without transactions, `POST` a request to `/create_block`:

```
POST /create_block
Expand All @@ -40,7 +40,7 @@ Response:

## Abort blocks

This functionality allows to simulate block abortion that can occur on mainnet.
This functionality allows simulating block abortion that can occur on mainnet.

You can abort blocks and revert transactions from the specified block to the currently latest block. Newly created blocks after the abortion will have accepted status and will continue with numbering where the last accepted block left off.

Expand Down
30 changes: 30 additions & 0 deletions website/docs/dump-load-restart.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,33 @@ If you dumped a Devnet utilizing one class for account predeployment (e.g. `--ac
Devnet can be restarted by making a `POST /restart` request (no body required). All of the deployed contracts (including predeployed), blocks and storage updates will be restarted to the original state, without the transactions and requests that may have been loaded from a dump file on startup.

If you're using [**the Hardhat plugin**](https://github.com/0xSpaceShard/starknet-hardhat-plugin#restart), restart with `starknet.devnet.restart()`.

## Docker

To enable dumping and loading with dockerized Devnet, you must bind the container path to the path on your host machine.

This example:

- Relies on [Docker bind mount](https://docs.docker.com/storage/bind-mounts/); try [Docker volume](https://docs.docker.com/storage/volumes/) instead.
- Assumes that `/path/to/dumpdir` exists. If unsure, use absolute paths.
- Assumes you are listening on `127.0.0.1:5050`.

If there is `mydump` inside `/path/to/dumpdir`, you can load it with:

```
docker run \
-p 127.0.0.1:5050:5050 \
--mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \
shardlabs/starknet-devnet-rs \
--dump-path /path/to/dumpdir/mydump
```

To dump to `/path/to/dumpdir/mydump` on Devnet shutdown, run:

```
docker run \
-p 127.0.0.1:5050:5050 \
--mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \
shardlabs/starknet-devnet-rs \
--dump-on exit --dump-path /path/to/dumpdir/mydump
```
4 changes: 2 additions & 2 deletions website/versioned_docs/version-0.0.6/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Response:

## Create an empty block

To create an empty block without transactions, `POST` a request to /create_block:
To create an empty block without transactions, `POST` a request to `/create_block`:

```
POST /create_block
Expand All @@ -40,7 +40,7 @@ Response:

## Abort blocks

This functionality allows to simulate block abortion that can occur on mainnet.
This functionality allows simulating block abortion that can occur on mainnet.

You can abort blocks and revert transactions from the specified block to the currently latest block. Newly created blocks after the abortion will have accepted status and will continue with numbering where the last accepted block left off.

Expand Down
30 changes: 30 additions & 0 deletions website/versioned_docs/version-0.0.6/dump-load-restart.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,33 @@ If you dumped a Devnet utilizing one class for account predeployment (e.g. `--ac
Devnet can be restarted by making a `POST /restart` request (no body required). All of the deployed contracts (including predeployed), blocks and storage updates will be restarted to the original state, without the transactions and requests that may have been loaded from a dump file on startup.

If you're using [**the Hardhat plugin**](https://github.com/0xSpaceShard/starknet-hardhat-plugin#restart), restart with `starknet.devnet.restart()`.

## Docker

To enable dumping and loading with dockerized Devnet, you must bind the container path to the path on your host machine.

This example:

- Relies on [Docker bind mount](https://docs.docker.com/storage/bind-mounts/); try [Docker volume](https://docs.docker.com/storage/volumes/) instead.
- Assumes that `/path/to/dumpdir` exists. If unsure, use absolute paths.
- Assumes you are listening on `127.0.0.1:5050`.

If there is `mydump` inside `/path/to/dumpdir`, you can load it with:

```
docker run \
-p 127.0.0.1:5050:5050 \
--mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \
shardlabs/starknet-devnet-rs \
--dump-path /path/to/dumpdir/mydump
```

To dump to `/path/to/dumpdir/mydump` on Devnet shutdown, run:

```
docker run \
-p 127.0.0.1:5050:5050 \
--mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \
shardlabs/starknet-devnet-rs \
--dump-on exit --dump-path /path/to/dumpdir/mydump
```

0 comments on commit e68a44a

Please sign in to comment.