Skip to content

Commit 9e162e4

Browse files
authored
docs(book): book auto formatting & update cli commands docs (#817)
1 parent 20e989f commit 9e162e4

File tree

18 files changed

+324
-116
lines changed

18 files changed

+324
-116
lines changed

.vscode/extensions.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@
1010
"ryanluker.vscode-coverage-gutters",
1111
// direnv, to use tool binaries from `nix` profile and set environment variables automatically
1212
"mkhl.direnv",
13+
// Used for markdown formating
14+
"esbenp.prettier-vscode"
1315
]
14-
}
16+
}

.vscode/settings.default.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// Rust-analyzer doesn't need to build the wasm binary
1616
"rust-analyzer.cargo.extraEnv": {
1717
"SKIP_WASM_BUILD": "true"
18+
},
19+
"[markdown]": {
20+
"editor.defaultFormatter": "esbenp.prettier-vscode"
1821
}
1922
// Recommended when developing benchmarks
2023
/*

docs/src/architecture/index.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ We do provide an implementation of the storage provider, you can read more about
2222

2323
![](../images/architecture/pallets_overview.png)
2424

25-
We've been focusing on implementing the core functionality by developing the market, storage provider, proofs and randomness pallets.
25+
We've been focusing on implementing the core functionality by developing the market, storage provider, proofs, randomness and faucet pallets.
2626

2727
The market pallet handles all things related to deal payments and slashing,
2828
being informed by the storage provider when deals haven't been proven and applying slashing in those cases.
@@ -35,11 +35,12 @@ For a deeper dive on the pallets, you can read the [Pallets chapter](./pallets/i
3535
## Resources on Parachains
3636

3737
Reading:
38-
* [Parachains' Protocol Overview](https://wiki.polkadot.network/docs/learn-parachains-protocol)
39-
* [The Path of a Parachain Block](https://polkadot.com/blog/the-path-of-a-parachain-block)
38+
39+
- [Parachains' Protocol Overview](https://wiki.polkadot.network/docs/learn-parachains-protocol)
40+
- [The Path of a Parachain Block](https://polkadot.com/blog/the-path-of-a-parachain-block)
4041

4142
Videos:
42-
* [Introduction to Polkadot, Parachains, and Substrate](https://www.youtube.com/live/gT-9r1bcVHY?si=dmCJyWB5w2NY1bnu&t=1670)
43-
* [The Path of a Parachain Block - Joe Petrowski](https://www.youtube.com/watch?v=vRsBlVELQEo)
44-
* [The Path of a Parachain Block on Polkadot and Kusama Network](https://www.youtube.com/watch?v=m0vxqWwFfDs)
4543

44+
- [Introduction to Polkadot, Parachains, and Substrate](https://www.youtube.com/live/gT-9r1bcVHY?si=dmCJyWB5w2NY1bnu&t=1670)
45+
- [The Path of a Parachain Block - Joe Petrowski](https://www.youtube.com/watch?v=vRsBlVELQEo)
46+
- [The Path of a Parachain Block on Polkadot and Kusama Network](https://www.youtube.com/watch?v=m0vxqWwFfDs)

docs/src/architecture/pallets/index.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- [`market`](market.md) - A pallet that handles the storage market operations.
55
- [`proofs`](proofs.md) - A pallet responsible for verifying [PoRep](../../glossary.md#porep) and [PoSt](../../glossary.md#post).
66
- [`randomness`](randomness.md) - A pallet providing randomness source for blocks, mainly used by Proofs.
7+
- [`faucet`](faucet.md) - A pallet that provides a means to distribute tokens for testing purposes.
78

89
## Overview
910

@@ -51,5 +52,3 @@ Finally, storage providers can then settle deal payments to receive their fair s
5152
Putting it all together, we get the following:
5253

5354
<img id="figure-overview" src="../../images/overview_flow.svg" alt="The described flow">
54-
55-

docs/src/architecture/pallets/storage-provider-extra.md

-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ Sealing a sector using Proof-of-Replication (PoRep) is a computation-intensive p
4747
- **Run a SNARK on the Proof**: Compress the proof using a Succinct Non-interactive Argument of Knowledge (SNARK).
4848
- **Submit the Compressed Proof:** Submit the result of the compression to the blockchain as certification of the storage commitment.
4949

50-
5150
## Usage
5251

5352
### Modifying storage provider information
5453

5554
The `Storage Provider Pallet` allows storage providers to modify their information such as changing the peer id, through `change_peer_id` and changing owners, through `change_owner_address`.
5655

57-
5856
## Storage Provider Flow
5957

6058
### Registration

docs/src/architecture/polka-storage-provider-server.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ To achieve that, the pipeline is composed of 3 main stages.
9696

9797
### Add Piece
9898

99-
The Add Piece stage gathers pieces into unsealed sectors, preparing them for the next steps.
99+
The Add Piece stage gathers pieces into unsealed sectors, preparing them for the next steps. The pipeline uses a configured fill threshold (default 95%) to determine when a sector is ready for sealing, or will seal after a configured delay even if not completely filled. The time-based sealing is important because once a storage deal is published, the storage provider has made a formal commitment to store that data. If the storage provider fails to complete the sealing process and prove storage after this commitment, they risk being slashed (penalized).
100100

101101
While the system can theoretically support multiple sector sizes (2KiB, 8MiB, 512MiB and 1GiB), only the 1GiB sector size is considered safe for production use. Other sector sizes should be considered experimental and are not recommended for production deployments.
102102

docs/src/getting-started/building/index.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@ Quick reminder that Windows is not part of the supported operating systems.
77
As such, the following guides <b>have not been tested</b> on Windows.
88
</div>
99

10-
1110
We'll be building 5 artifacts:
1211

13-
* `polka-storage-node` — the Polka Storage Polkadot parachain node.
14-
* `polka-storage-provider-server` — the Polka Storage Storage Provider,
12+
- `polka-storage-node` — the Polka Storage Polkadot parachain node.
13+
- `polka-storage-provider-server` — the Polka Storage Storage Provider,
1514
responsible for accepting deals, storing files and executing storage proofs.
16-
* `polka-storage-provider-client` — the Polka Storage Storage Provider client,
15+
- `polka-storage-provider-client` — the Polka Storage Storage Provider client,
1716
this CLI tool has several utilities to interact with the Storage Provider server,
1817
such as proposing and publishing deals, as well as some wallet utilities and proof demos.
19-
* `mater-cli` — the Mater CLI enables you to convert files into CARv2 archives,
18+
- `mater-cli` — the Mater CLI enables you to convert files into CARv2 archives,
2019
an essential part of preparing files for submission to the network.
21-
* `storagext-cli` — the Storagext CLI is a lower-level tool to manually run the Polka Storage extrinsics.
20+
- `storagext-cli` — the Storagext CLI is a lower-level tool to manually run the Polka Storage extrinsics.
2221

2322
To build these artifacts, we provide two main methods:
2423

25-
* [Building from source](./source.md)
26-
* [Building with Docker](./docker.md)
24+
- [Building from source](./source.md)
25+
- [Building with Docker](./docker.md)

docs/src/getting-started/building/source.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
This guide will outline how to setup your environment to build the Polka Storage parachain,
44
we cover how to build the binaries directly on your system or using [Nix](https://nixos.org/download/) to ease the process.
55

6-
* [Get the code](#get-the-code)
7-
* [System dependencies](#system-dependencies)
8-
* [Using Nix](#using-nix)
9-
* [Pre-requisites](#pre-requisites)
10-
* [Building](#building)
6+
- [Get the code](#get-the-code)
7+
- [System dependencies](#system-dependencies)
8+
- [Using Nix](#using-nix)
9+
- [Pre-requisites](#pre-requisites)
10+
- [Building](#building)
1111

1212
## Get the code
1313

@@ -22,9 +22,9 @@ cd polka-storage
2222

2323
To build the binaries directly on your system you will need the following tools:
2424

25-
* Rust 1.81.0 — you can install it using [`rustup`](https://rustup.rs/) and its [guide](https://rust-lang.github.io/rustup/installation/other.html) for help.
26-
* Other dependencies — keep reading, we'll get to it after the end of this list!
27-
* `just` (optional) — (after installing Rust) you can use `cargo install just` or check the [official list of packages](https://just.systems/man/en/packages.html).
25+
- Rust 1.81.0 — you can install it using [`rustup`](https://rustup.rs/) and its [guide](https://rust-lang.github.io/rustup/installation/other.html) for help.
26+
- Other dependencies — keep reading, we'll get to it after the end of this list!
27+
- `just` (optional) — (after installing Rust) you can use `cargo install just` or check the [official list of packages](https://just.systems/man/en/packages.html).
2828

2929
The dependencies mentioned are for Linux distros using the `apt` family of package managers.
3030
Different systems may use different package managers, as such, they may require you to find the equivalent package.
@@ -40,7 +40,7 @@ $ sudo apt install -y libhwloc-dev \
4040
clang \
4141
build-essential \
4242
git \
43-
libssl-dev \
43+
libssl-dev \
4444
curl
4545
```
4646

@@ -56,15 +56,15 @@ Details can be found <a href="https://docs.nvidia.com/cuda/wsl-user-guide/index.
5656
</div>
5757

5858
Requirements:
59-
* GCC 13
60-
* NVIDIA GPU
61-
* [Cuda drivers & toolkit (nvcc)](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#overview)
6259

60+
- GCC 13
61+
- NVIDIA GPU
62+
- [Cuda drivers & toolkit (nvcc)](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#overview)
6363

6464
<div class="warning">
6565

6666
Not all of the binaries can be built from the polka-storage repository!
67-
We depend on the <a href="https://github.com/paritytech/zombienet/releases/tag/v1.3.116">zombienet</a> and <a href="https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2409-2">polkadot, polkadot-prepare-worker, polkadot-execute-worker</a> binaries which need to be downloaded regardless (if not using <a href="#using-nix">Nix</a>).
67+
We depend on the <a href="https://github.com/paritytech/zombienet/releases/tag/v1.3.116">zombienet</a> and <a href="https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-stable2412">polkadot, polkadot-prepare-worker, polkadot-execute-worker</a> binaries which need to be downloaded regardless (if not using <a href="#using-nix">Nix</a>).
6868

6969
</div>
7070

@@ -122,7 +122,6 @@ cargo build --release -p polka-storage-provider-server --no-default-features --f
122122
cargo build --release -p polka-storage-provider-client --no-default-features --features cuda
123123
```
124124

125-
126125
For more information on what each binary does, refer to [Building](./index.md).
127126

128127
### Just recipes
@@ -151,10 +150,11 @@ $ target/release/<BINARY-NAME>
151150
```
152151

153152
Where `<BINARY-NAME>` is one of:
154-
* `polka-storage-node`
155-
* `polka-storage-provider-server`
156-
* `polka-storage-provider-client`
157-
* `mater-cli`
158-
* `storagext-cli`
153+
154+
- `polka-storage-node`
155+
- `polka-storage-provider-server`
156+
- `polka-storage-provider-client`
157+
- `mater-cli`
158+
- `storagext-cli`
159159

160160
> Additionally, you can move them to a folder under your `$PATH` and run them as you would with any other binary.

docs/src/getting-started/demo-file-store.md

+15-16
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Before reading this guide, please follow the <a href="./local-testnet.md">local
55
You should have a working testnet and a Storage Provider running!
66
</div>
77

8-
98
## Storage Client
9+
1010
<img class="right" src="../images/polkadot.svg" alt="The Polkadot logo" style="height: 100px; padding: 4px 8px 4px;">
1111

1212
Alice is a [Storage User](../glossary.md#storage-user) and wants to store an image of her lovely Polkadot logo [`polkadot.svg`](../images/polkadot.svg) in the Polka Storage [parachain](../glossary.md#parachain).
@@ -35,7 +35,6 @@ $ polka-storage-provider-client proofs commp polkadot.car
3535
Afterwards, it's time to propose a deal, currently — i.e. while the network isn't live —
3636
any deals will be accepted by Charlie (the Storage Provider).
3737

38-
3938
Alice fills out the deal form according to a JSON template (`polka-logo-deal.json`):
4039

4140
```json
@@ -53,19 +52,18 @@ Alice fills out the deal form according to a JSON template (`polka-logo-deal.jso
5352
}
5453
```
5554

56-
* `piece_cid` — is the `cid` field from the previous step, where she calculated the piece commitment. It uniquely identifies the piece.
57-
* `piece_size` — is the `size` field from the previous step, where she calculated the piece commitment. It is the size of the processed piece, not the original file!
58-
* `client` — is the client's (i.e. the reader's) public key, encoded in bs58 format.
55+
- `piece_cid` — is the `cid` field from the previous step, where she calculated the piece commitment. It uniquely identifies the piece.
56+
- `piece_size` — is the `size` field from the previous step, where she calculated the piece commitment. It is the size of the processed piece, not the original file!
57+
- `client` — is the client's (i.e. the reader's) public key, encoded in bs58 format.
5958
For more information on how to generate your own keypair, read the [Polka Storage Provider CLI/`client`/`wallet`](../storage-provider-cli/client/wallet.md).
60-
* `provider` — is the storage provider's public key, encoded in bs58 format.
59+
- `provider` — is the storage provider's public key, encoded in bs58 format.
6160
If you don't know your storage provider's public key, you can query it using `polka-storage-provider-client`'s `info` command.
62-
* `label` — is an arbitrary string to be associated with the deal.
63-
* `start_block` — is the deal's start block, it MUST be positive and lower than `end_block`.
64-
* `end_block` — is the deal's end block, it must be positive and larger than `start_block`.
65-
* `storage_price_per_block` — the storage price over the duration of a single block — e.g. if your deal is 20 blocks long, it will cost `20 * storage_price_per_block` in total.
66-
* `provider_collateral` — the price to pay *by the storage provider* if they fail to uphold the deal.
67-
* `state` — the deal state, only `Published` is accepted.
68-
61+
- `label` — is an arbitrary string to be associated with the deal.
62+
- `start_block` — is the deal's start block, it MUST be positive and lower than `end_block`.
63+
- `end_block` — is the deal's end block, it must be positive and larger than `start_block`.
64+
- `storage_price_per_block` — the storage price over the duration of a single block — e.g. if your deal is 20 blocks long, it will cost `20 * storage_price_per_block` in total.
65+
- `provider_collateral` — the price to pay _by the storage provider_ if they fail to uphold the deal.
66+
- `state` — the deal state, only `Published` is accepted.
6967

7068
<div class="warning">
7169

@@ -137,7 +135,8 @@ $ polka-storage-provider-client sign-deal --sr25519-key "//Alice" @polka-logo-de
137135
}
138136
```
139137
140-
> Hint: you can write the following command to *just* get the file:
138+
> Hint: you can write the following command to _just_ get the file:
139+
>
141140
> ```
142141
> polka-storage-provider-client sign-deal --sr25519-key "//Alice" @polka-logo-deal.json > signed-logo-deal.json
143142
> ```
@@ -159,8 +158,8 @@ On Alice's side, that's it!
159158
160159
## Additional Notes
161160
162-
* As other parts of this project, file retrieval is actively being worked on! 🚧
163-
* Files stored in storage providers are public, as such, we suggest you encrypt your files.
161+
- As other parts of this project, file retrieval is actively being worked on! 🚧
162+
- Files stored in storage providers are public, as such, we suggest you encrypt your files.
164163
While file encryption is a broad enough topic, if you not sure about which tools to use,
165164
we suggest you keep it simple by compressing your file in a format such as [7zip](https://www.7-zip.org/) and using its encryption features.
166165
If 7zip doesn't cut it, you may want to take a look into [age](https://github.com/FiloSottile/age) or [VeraCrypt](https://www.veracrypt.fr/code/VeraCrypt/).

docs/src/getting-started/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ Before proceeding with the setup, please ensure the host system meets the follow
2020
- [_Local Testnet - Polka Storage Parachain_](local-testnet/index.md) — Covers how to setup a local testnet for the Polka Storage parachain, using Zombienet.
2121
- [_Launching a Storage Provider_](storage-provider.md) - Covers how to setup a Storage Provider.
2222
- [_Storing a file_](demo-file-store.md) — Covers how to store a file by the Storage Client.
23-
24-

docs/src/getting-started/local-testnet/getting-funds.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Please make sure to follow the instructions on how to generate a new account if
1010
You can read more about creating a Polkadot account using the extension in the following [link](https://support.polkadot.network/support/solutions/articles/65000098878-how-to-create-a-dot-account#How-to-create-an-account-with-the-Polkadot-extension)
1111

1212
Or you can watch the following video:
13+
1314
<iframe
1415
style="display:block; margin-left:auto; margin-right:auto"
1516
width="560"
@@ -47,11 +48,11 @@ Make sure to run the local testnet, you can find how to do so in the [local test
4748
> If you have changed the `ws_port` value in the zombienet configuration — `local-testnet.toml`,
4849
> this URL is different and you should change the port accordingly.
4950
50-
Under the developer tab, navigate to *Sudo*.
51+
Under the developer tab, navigate to _Sudo_.
5152

5253
![sudo selection](../../images/transfer-funds/developer-sudo.png)
5354

54-
Once you are in *Sudo* you should select `balances` from the submit dropdown.
55+
Once you are in _Sudo_ you should select `balances` from the submit dropdown.
5556

5657
![balance selection](../../images/transfer-funds/select-balance.png)
5758

docs/src/getting-started/local-testnet/index.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ This link will automatically connect to Charlie's node running on a local machin
265265
## Checking the logs
266266

267267
At the end of the `zombienet` output you should see a table like so:
268+
268269
```
269270
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
270271
│ Node Information │
@@ -288,6 +289,7 @@ We strongly recommend you check the logs for the collator (in this case Charlie)
288289

289290
> If the **Log Cmd** is shortened with `...`, try to search for the folder using the zombienet namespace, available at the top of the table.
290291
> For example:
292+
>
291293
> ```bash
292294
> $ ls /tmp | grep zombie-bcb786e1748ff0a6becd28289e1f70b9
293295
> ```
@@ -306,20 +308,23 @@ $ grep "<LOG_LEVEL>.*runtime::<EXTRINSIC_PALLET>" charlie.log
306308
```
307309
308310
Where `LOG_LEVEL` is one of:
309-
* `DEBUG`
310-
* `INFO`
311-
* `WARN`
312-
* `ERROR`
311+
312+
- `DEBUG`
313+
- `INFO`
314+
- `WARN`
315+
- `ERROR`
313316
314317
And the extrinsic pallet, is one of:
315-
* `storage_provider`
316-
* `market`
317-
* `proofs`
318+
319+
- `storage_provider`
320+
- `market`
321+
- `proofs`
318322
319323
> **Tip:** if you are running into the `AllProposalsInvalid` error,
320324
> try searching for `insane deal` in the logs, you should find the cause faster!
321325
>
322326
> For example:
327+
>
323328
> ```bash
324329
> $ grep "insane deal" -B 1 charlie.log
325330
> 2024-11-14 13:24:24.019 ERROR tokio-runtime-worker runtime::market: [Parachain] deal duration too short: 100 < 288000

0 commit comments

Comments
 (0)