Skip to content

Commit b5f305a

Browse files
authored
Added requirements section + --ipfs-server arg to the README.md (#51)
* Added `--ipfs-server` arg * Added requirements * typo * Nit * Nits * Add litep2p check on startup (just in case)
1 parent 6b85c77 commit b5f305a

File tree

4 files changed

+47
-7
lines changed

4 files changed

+47
-7
lines changed

README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,39 @@ Stores arbitrary data on IPFS via the `store` extrinsic, provided that either th
5252

5353
## Prepare for a production
5454

55+
### Requirements
56+
57+
#### Validator node args
58+
59+
The validator node should be started with the following arguments:
60+
* `--ipfs-server` - enables IPFS support.
61+
* `--network-backend=litep2p` - enables Bitswap support, which is only available with the litep2p network backend, but this is Substrate’s default.
62+
63+
#### Storage
64+
65+
There are no special requirements for the production runtime (just as the usual [validator/node](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator)), except those related to IPFS support.
66+
With the current configuration, the maximum storage requirement is estimated as follows:
67+
68+
* Storing data for up to 2 weeks:
69+
70+
$$
71+
2 \times 7 \times 24 \times 60 \times 60 = 1,209,600 \, \text{seconds}
72+
$$
73+
74+
divided by a 6-second block time = **201,600 blocks**
75+
76+
* Each block can contain up to 8–10 MiB (based on `MaxTransactionSize = 8 MiB` and `BlockLength = 10 MiB`)
77+
* Total = **1,612,800–2,016,000 MiB ≈ 1,575–1,968 GiB of storage (maximum)**
78+
79+
But this is the maximum limit, assuming full utilization of every block for two weeks, which we are unlikely to reach.
80+
81+
TODO: @georgepisaltu Can we provide a more realistic estimate based on the testnet data?
82+
83+
TODO: @georgepisaltu Is this still valid that we need to keep 2-week data?
84+
5585
### Prepare keys for a production chain
5686

57-
This chapter provides a one-time example setup. For more details about running a validator and key management, see: [https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator.”](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator.”).
87+
This chapter provides a one-time example setup. For more details about running a validator and key management, see: [https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator](https://docs.polkadot.com/infrastructure/running-a-validator/#running-a-validator.”).
5888

5989
**Prerequisites:**
6090
```
@@ -166,11 +196,11 @@ _Note: This is relevant only for the initial launch; after that, we expect Polka
166196
* Run node
167197
```
168198
# point to updated chain spec
169-
./target/release/polkadot-bulletin-chain --validator --chain ./node/chain-specs/bulletin-polkadot.json --base-path /tmp/bulletin --node-key-file /tmp/bulletin/chains/bulletin-polkadot/network/secret_ed25519
199+
./target/release/polkadot-bulletin-chain --ipfs-server --validator --chain ./node/chain-specs/bulletin-polkadot.json --base-path /tmp/bulletin --node-key-file /tmp/bulletin/chains/bulletin-polkadot/network/secret_ed25519
170200
or
171201
# rebuild because of updated chain spec
172202
cargo build --release -p polkadot-bulletin-chain
173-
./target/release/polkadot-bulletin-chain --validator --chain bulletin-polkadot --base-path /tmp/bulletin --node-key-file /tmp/bulletin/chains/bulletin-polkadot/network/secret_ed25519
203+
./target/release/polkadot-bulletin-chain --ipfs-server --validator --chain bulletin-polkadot --base-path /tmp/bulletin --node-key-file /tmp/bulletin/chains/bulletin-polkadot/network/secret_ed25519
174204
```
175205
* **You should see finalized blocks in the logs.**
176206
* **!!! Push changes `./scripts/create_bulletin_polkadot_spec.sh` !!!**
@@ -180,7 +210,7 @@ _Note: This is relevant only for the initial launch; after that, we expect Polka
180210
### Run production chain
181211
```
182212
# You can omit `--validator` if you are not part of the active validator set.
183-
./target/release/polkadot-bulletin-chain --validator --chain bulletin-polkadot <other-relevant-params: ./target/release/polkadot-bulletin-chain --help>
213+
./target/release/polkadot-bulletin-chain --ipfs-server --validator --chain bulletin-polkadot <other-relevant-params: ./target/release/polkadot-bulletin-chain --help>
184214
```
185215

186216
### Run local chain

node/src/command.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use crate::{
77
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
88
use polkadot_bulletin_chain_runtime::Block;
99
use sc_cli::SubstrateCli;
10+
use sc_network::config::NetworkBackendType;
1011
use sc_service::PartialComponents;
1112
use std::{sync::Arc, time::Duration};
12-
1313
#[cfg(feature = "try-runtime")]
1414
use {
1515
polkadot_bulletin_chain_runtime::SLOT_DURATION,
@@ -239,6 +239,18 @@ pub fn run() -> sc_cli::Result<()> {
239239
config.network.idle_connection_timeout = IPFS_WORKAROUND_TIMEOUT;
240240
}
241241

242+
if config.network.ipfs_server {
243+
match config.network.network_backend {
244+
NetworkBackendType::Litep2p => (),
245+
NetworkBackendType::Libp2p => {
246+
return Err(
247+
"For `ipfs-server`, we expect only the `config.network.network_backend=litep2p` (`--network-backend=litep2p`) setting, because Bitswap support requires it!"
248+
.into(),
249+
)
250+
}
251+
}
252+
}
253+
242254
service::new_full::<sc_network::Litep2pNetworkBackend>(config)
243255
.map_err(sc_cli::Error::Service)
244256
})

runtime/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ pallet-xcm = { optional = true, workspace = true }
8787
pallet-staking = { optional = true, workspace = true }
8888
sp-staking = { optional = true, workspace = true }
8989
parachains-common = { optional = true, workspace = true }
90-
# pallet-revive = { optional = true, workspace = true }
9190

9291
[build-dependencies]
9392
substrate-wasm-builder = { optional = true, workspace = true }

runtimes/bulletin-polkadot/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ pallet-xcm = { optional = true, workspace = true }
8484
pallet-staking = { optional = true, workspace = true }
8585
sp-staking = { optional = true, workspace = true }
8686
parachains-common = { optional = true, workspace = true }
87-
# pallet-revive = { optional = true, workspace = true }
8887

8988
[build-dependencies]
9089
substrate-wasm-builder = { optional = true, workspace = true }

0 commit comments

Comments
 (0)