diff --git a/docs/src/storage-provider-cli/server.md b/docs/src/storage-provider-cli/server.md index e428af8d4..1a4ae3ab5 100644 --- a/docs/src/storage-provider-cli/server.md +++ b/docs/src/storage-provider-cli/server.md @@ -4,27 +4,6 @@ This chapter covers the available CLI options for the Polka Storage Provider ser -#### `--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: `:`. -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: `:`. -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`. @@ -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: `:`. +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: `:`. +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. @@ -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//deals_database` | +| `storage-directory` | `/tmp//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", +} +``` diff --git a/examples/sp.config.json b/examples/sp.config.json deleted file mode 100644 index e69de29bb..000000000 diff --git a/primitives/src/proofs.rs b/primitives/src/proofs.rs index aebef7d55..646ed6b35 100644 --- a/primitives/src/proofs.rs +++ b/primitives/src/proofs.rs @@ -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 @@ -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. @@ -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: diff --git a/storage-provider/server/src/config.rs b/storage-provider/server/src/config.rs index 02ac5bf1b..1e71eceeb 100644 --- a/storage-provider/server/src/config.rs +++ b/storage-provider/server/src/config.rs @@ -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,