Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmg-duarte committed Jan 14, 2025
1 parent db24992 commit 6b47b02
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 22 deletions.
76 changes: 55 additions & 21 deletions docs/src/storage-provider-cli/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@ This chapter covers the available CLI options for the Polka Storage Provider ser

<!-- Sadly, tables will not cut it here, since the text is just too big for the table. -->

#### `--upload-listen-address`

The storage server's endpoint address — i.e. where the client will upload their files to.

It takes in an IP address along with a port in the format: `<ip>:<port>`.
Defaults to `127.0.0.1:8001`.

#### `--rpc-listen-address`

The RPC server endpoint's address — i.e. where you will submit your deals to.

It takes in an IP address along with a port in the format: `<ip>:<port>`.
Defaults to `127.0.0.1:8000`.

#### `--node-url`

The target parachain node's address — i.e. the parachain node the storage provider will submit deals to, etc.

It takes in an URL, it supports both HTTP and WebSockets and their secure variants.
Defaults to `ws://127.0.0.1:42069`.

### `--sr25519-key`

Sr25519 keypair, encoded as hex, BIP-39 or a dev phrase like `//Alice`.
Expand All @@ -49,6 +28,27 @@ See [`sp_core::crypto::Pair::from_string_with_seed`](https://docs.rs/sp-core/lat

If this `--ed25519-key` is not used, either [`--ecdsa-key`](#--ecdsa-key) or [`--sr25519-key`](#--sr25519-key) MUST be used.

### `--upload-listen-address`

The storage server's endpoint address — i.e. where the client will upload their files to.

It takes in an IP address along with a port in the format: `<ip>:<port>`.
Defaults to `127.0.0.1:8001`.

### `--rpc-listen-address`

The RPC server endpoint's address — i.e. where you will submit your deals to.

It takes in an IP address along with a port in the format: `<ip>:<port>`.
Defaults to `127.0.0.1:8000`.

### `--node-url`

The target parachain node's address — i.e. the parachain node the storage provider will submit deals to, etc.

It takes in an URL, it supports both HTTP and WebSockets and their secure variants.
Defaults to `ws://127.0.0.1:42069`.

### `--database-directory`

The RocksDB storage directory, where deal information will be kept.
Expand All @@ -72,3 +72,37 @@ The kind of replication proof. Currently, only `StackedDRGWindow2KiBV1P1` is sup
### `--post-proof`

The kind of storage proof. Currently, only `StackedDRGWindow2KiBV1P1` is supported to which it defaults.

### `--porep-parameters`

The path to the PoRep proving parameters. They are shared across all of the nodes in the network, as the chain stores corresponding Verifying Key parameters.

### `--post-parameters`

The path to the PoSt proving parameters. They are shared across all of the nodes in the network, as the chain stores corresponding Verifying Key parameters.

### `--config`

Takes in a path to a configuration file, it supports both JSON and TOML (files _must_ have the right extension).
The supported configuration parameters are:

| Name | Default |
| ----------------------- | ------------------------------ |
| `upload-listen-address` | `127.0.0.1:8000` |
| `rpc-listen-address` | `127.0.0.1:8001` |
| `node-url` | `ws://127.0.0.1:42069` |
| `database-directory` | `/tmp/<random>/deals_database` |
| `storage-directory` | `/tmp/<random>/deals_storage` |
| `seal-proof` | 2KiB |
| `post-proof` | 2KiB |
| `porep_parameters` | NA |
| `post_parameters` | NA |

#### Bare bones configuration

```json
{
"porep_parameters": "/home/storage_provider/porep.params",
"post_parameters": "/home/storage_provider/post.params",
}
```
Empty file removed examples/sp.config.json
Empty file.
20 changes: 19 additions & 1 deletion primitives/src/proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ pub enum RegisteredSealProof {

impl RegisteredSealProof {
pub fn sector_size(&self) -> SectorSize {
SectorSize::_2KiB
match self {
RegisteredSealProof::StackedDRG2KiBV1P1 => SectorSize::_2KiB,
}
}

/// Produces the windowed PoSt-specific RegisteredProof corresponding
Expand All @@ -79,6 +81,14 @@ impl RegisteredSealProof {
RegisteredSealProof::StackedDRG2KiBV1P1 => 192,
}
}

/// Returns [`StackedDRG2KiBV1P1`](RegisteredSealProof::StackedDRG2KiBV1P1).
// NOTE(@jmg-duarte,14/01/2025): wanted to avoid setting a default to use in serde
// this is the alternative
#[allow(non_snake_case)]
pub const fn _2KiB() -> Self {
Self::StackedDRG2KiBV1P1
}
}

/// Proof of Spacetime type, indicating version and sector size of the proof.
Expand Down Expand Up @@ -122,6 +132,14 @@ impl RegisteredPoStProof {
RegisteredPoStProof::StackedDRGWindow2KiBV1P1 => 2,
}
}

/// Returns [`StackedDRGWindow2KiBV1P1`](RegisteredPoStProof::StackedDRGWindow2KiBV1P1).
// NOTE(@jmg-duarte,14/01/2025): wanted to avoid setting a default to use in serde
// this is the alternative
#[allow(non_snake_case)]
pub const fn _2KiB() -> Self {
Self::StackedDRGWindow2KiBV1P1
}
}

// serde_json requires std, hence, to test the serialization, we need:
Expand Down
2 changes: 2 additions & 0 deletions storage-provider/server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ pub struct ConfigurationArgs {
// NOTE: the following parameters are marked as "not required" so the CLI doesn't require them
// when --config is used, otherwise, they're very much required
/// Proof of Replication proof type.
#[serde(default = "RegisteredSealProof::_2KiB")]
#[arg(long, required = false)]
pub(crate) seal_proof: RegisteredSealProof,

/// Proof of Spacetime proof type.
#[serde(default = "RegisteredPoStProof::_2KiB")]
#[arg(long, required = false)]
pub(crate) post_proof: RegisteredPoStProof,

Expand Down

0 comments on commit 6b47b02

Please sign in to comment.