Skip to content

Commit

Permalink
Merge pull request #2177 from subspace/prepare-gemini-3g-chain-spec
Browse files Browse the repository at this point in the history
Prepare for Gemini 3g
  • Loading branch information
nazar-pc authored Oct 30, 2023
2 parents 31ab035 + 2a42947 commit f8386a5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/chain-spec-snapshot-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ jobs:

- name: Generate testnet chain specifications
run: |
docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain gemini-3f-compiled --disable-default-bootnode > chain-spec-gemini-3f.json
docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain gemini-3f-compiled --disable-default-bootnode --raw > chain-spec-raw-gemini-3f.json
docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain gemini-3g-compiled --disable-default-bootnode > chain-spec-gemini-3g.json
docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain gemini-3g-compiled --disable-default-bootnode --raw > chain-spec-raw-gemini-3g.json
- name: Upload chain specifications to artifacts
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # @v3.1.1
with:
name: chain-specifications
path: |
chain-spec-gemini-3f.json
chain-spec-raw-gemini-3f.json
chain-spec-gemini-3g.json
chain-spec-raw-gemini-3g.json
if-no-files-found: error

- name: Upload chain specifications to assets
uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93 # @0.4.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["chain-spec-gemini-3f.json", "chain-spec-raw-gemini-3f.json"]'
asset_paths: '["chain-spec-gemini-3g.json", "chain-spec-raw-gemini-3g.json"]'
14 changes: 7 additions & 7 deletions crates/subspace-node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ struct GenesisParams {
confirmation_depth_k: u32,
}

pub fn gemini_3f_compiled() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>, String> {
pub fn gemini_3g_compiled() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>, String> {
Ok(ConsensusChainSpec::from_genesis(
// Name
"Subspace Gemini 3f",
"Subspace Gemini 3g",
// ID
"subspace_gemini_3f",
ChainType::Custom("Subspace Gemini 3f".to_string()),
"subspace_gemini_3g",
ChainType::Custom("Subspace Gemini 3g".to_string()),
|| {
let sudo_account =
AccountId::from_ss58check("5DNwQTHfARgKoa2NdiUM51ZUow7ve5xG9S2yYdSbVQcnYxBA")
Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn gemini_3f_compiled() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>,
.map_err(|error| error.to_string())?,
),
// Protocol ID
Some("subspace-gemini-3f"),
Some("subspace-gemini-3g"),
None,
// Properties
Some({
Expand All @@ -187,8 +187,8 @@ pub fn gemini_3f_compiled() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>,
))
}

pub fn gemini_3f_config() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>, String> {
unimplemented!("Please use release prefixed with Gemini-3f.")
pub fn gemini_3g_config() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>, String> {
unimplemented!("Please use release prefixed with Gemini-3g.")
}

pub fn devnet_config() -> Result<ConsensusChainSpec<RuntimeGenesisConfig>, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-node/src/domain/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ impl BuildGenesisStorageCmd {
let is_dev = self.shared_params.is_dev();
let chain_id = self.shared_params.chain_id(is_dev);
let domain_genesis_config = match chain_id.as_str() {
"gemini-3f" => evm_chain_spec::get_testnet_genesis_by_spec_id(SpecId::Gemini).0,
"gemini-3g" => evm_chain_spec::get_testnet_genesis_by_spec_id(SpecId::Gemini).0,
"devnet" => evm_chain_spec::get_testnet_genesis_by_spec_id(SpecId::DevNet).0,
"dev" => evm_chain_spec::get_testnet_genesis_by_spec_id(SpecId::Dev).0,
"" | "local" => evm_chain_spec::get_testnet_genesis_by_spec_id(SpecId::Local).0,
unknown_id => {
eprintln!(
"unknown chain {unknown_id:?}, expected gemini-3f, devnet, dev, or local",
"unknown chain {unknown_id:?}, expected gemini-3g, devnet, dev, or local",
);
return Ok(());
}
Expand Down
12 changes: 6 additions & 6 deletions crates/subspace-node/src/domain/evm_chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,22 @@ pub fn local_testnet_config<F: Fn() -> RuntimeGenesisConfig + 'static + Send + S
)
}

pub fn gemini_3f_config<F: Fn() -> RuntimeGenesisConfig + 'static + Send + Sync>(
pub fn gemini_3g_config<F: Fn() -> RuntimeGenesisConfig + 'static + Send + Sync>(
constructor: F,
) -> ExecutionChainSpec<RuntimeGenesisConfig> {
ExecutionChainSpec::from_genesis(
// Name
"Subspace Gemini 3f EVM Domain",
"Subspace Gemini 3g EVM Domain",
// ID
"subspace_gemini_3f_evm_domain",
"subspace_gemini_3g_evm_domain",
ChainType::Live,
constructor,
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
Some("subspace-gemini-3f-evm-domain"),
Some("subspace-gemini-3g-evm-domain"),
None,
// Properties
Some(chain_spec_properties()),
Expand Down Expand Up @@ -143,7 +143,7 @@ pub fn load_chain_spec(spec_id: &str) -> Result<Box<dyn sc_cli::ChainSpec>, Stri

let chain_spec = match spec_id {
"dev" => development_config(move || constructor(SpecId::Dev)),
"gemini-3f" => gemini_3f_config(move || constructor(SpecId::Gemini)),
"gemini-3g" => gemini_3g_config(move || constructor(SpecId::Gemini)),
"devnet" => devnet_config(move || constructor(SpecId::DevNet)),
"" | "local" => local_testnet_config(move || constructor(SpecId::Local)),
path => ChainSpec::from_json_file(std::path::PathBuf::from(path))?,
Expand Down Expand Up @@ -243,7 +243,7 @@ pub fn create_domain_spec(
let constructor = RuntimeGenesisConfig::default;
let mut chain_spec = match chain_id {
"dev" => development_config(constructor),
"gemini-3f" => gemini_3f_config(constructor),
"gemini-3g" => gemini_3g_config(constructor),
"devnet" => devnet_config(constructor),
"" | "local" => local_testnet_config(constructor),
path => ChainSpec::from_json_file(std::path::PathBuf::from(path))?,
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ impl SubstrateCli for Cli {

fn load_spec(&self, id: &str) -> Result<Box<dyn ChainSpec>, String> {
let mut chain_spec = match id {
"gemini-3f-compiled" => chain_spec::gemini_3f_compiled()?,
"gemini-3f" => chain_spec::gemini_3f_config()?,
"gemini-3g-compiled" => chain_spec::gemini_3g_compiled()?,
"gemini-3g" => chain_spec::gemini_3g_config()?,
"devnet" => chain_spec::devnet_config()?,
"devnet-compiled" => chain_spec::devnet_config_compiled()?,
"dev" => chain_spec::dev_config()?,
Expand Down
24 changes: 12 additions & 12 deletions docs/farming.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ If you're connected directly without any router, then again nothing needs to be
# Replace `INSERT_YOUR_ID` with a nickname you choose
# Copy all of the lines below, they are all part of the same command
.\NODE_FILE_NAME.exe `
--chain gemini-3f `
--chain gemini-3g `
--blocks-pruning 256 `
--state-pruning archive `
--state-pruning archive-canonical `
--no-private-ipv4 `
--validator `
--name "INSERT_YOUR_ID"
Expand Down Expand Up @@ -95,9 +95,9 @@ If you're connected directly without any router, then again nothing needs to be
# Replace `INSERT_YOUR_ID` with a nickname you choose
# Copy all of the lines below, they are all part of the same command
./NODE_FILE_NAME \
--chain gemini-3f \
--chain gemini-3g \
--blocks-pruning 256 \
--state-pruning archive \
--state-pruning archive-canonical \
--no-private-ipv4 \
--validator \
--name "INSERT_YOUR_ID"
Expand Down Expand Up @@ -149,9 +149,9 @@ After this, simply repeat the step you prompted for (step 4 or 6). This time, cl
# Replace `INSERT_YOUR_ID` with a nickname you choose
# Copy all of the lines below, they are all part of the same command
./NODE_FILE_NAME \
--chain gemini-3f \
--chain gemini-3g \
--blocks-pruning 256 \
--state-pruning archive \
--state-pruning archive-canonical \
--no-private-ipv4 \
--validator \
--name "INSERT_YOUR_ID"
Expand Down Expand Up @@ -213,10 +213,10 @@ services:
- "0.0.0.0:30433:30433/udp"
restart: unless-stopped
command: [
"--chain", "gemini-3f",
"--chain", "gemini-3g",
"--base-path", "/var/subspace",
"--blocks-pruning", "256",
"--state-pruning", "archive",
"--state-pruning", "archive-canonical",
"--port", "30333",
"--dsn-listen-on", "/ip4/0.0.0.0/udp/30433/quic-v1",
"--dsn-listen-on", "/ip4/0.0.0.0/tcp/30433",
Expand Down Expand Up @@ -284,7 +284,7 @@ You can read logs with `docker-compose logs --tail=1000 -f`, for the rest read [

## Checking results and interacting with the network

Visit [Polkadot.js explorer](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Feu-0.gemini-3f.subspace.network%2Fws#/explorer), from there you can interact with Subspace Network as any Substrate-based blockchain.
Visit [Polkadot.js explorer](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Feu-0.gemini-3g.subspace.network%2Fws#/explorer), from there you can interact with Subspace Network as any Substrate-based blockchain.

## Switching from older/different versions of Subspace

Expand All @@ -295,7 +295,7 @@ If you were running a node previously, and want to switch to a new snapshot, ple
# Replace `FARMER_FILE_NAME` with the name of the node file you downloaded from releases
./FARMER_FILE_NAME wipe PATH_TO_FARM
# Replace `NODE_FILE_NAME` with the name of the node file you downloaded from releases
./NODE_FILE_NAME purge-chain --chain gemini-3f
./NODE_FILE_NAME purge-chain --chain gemini-3g
```
Does not matter if the node/farmer executable is the previous one or from the new snapshot, both will work :)
The reason we require this is, with every snapshot change, the network might get partitioned, and you may be on a different genesis than the current one.
Expand All @@ -319,8 +319,8 @@ Below are some helpful samples:
- `./FARMER_FILE_NAME info PATH_TO_FARM`: show information about the farm at `PATH_TO_FARM`
- `./FARMER_FILE_NAME scrub PATH_TO_FARM`: Scrub the farm to find and fix farm at `PATH_TO_FARM` corruption
- `./FARMER_FILE_NAME wipe PATH_TO_FARM`: erases everything related to farmer if data were stored in `PATH_TO_FARM`
- `./NODE_FILE_NAME --base-path NODE_DATA_PATH --chain gemini-3f ...`: start node and store data in `NODE_DATA_PATH` instead of default location
- `./NODE_FILE_NAME purge-chain --base-path NODE_DATA_PATH --chain gemini-3f`: erases data related to the node if data were stored in `NODE_DATA_PATH`
- `./NODE_FILE_NAME --base-path NODE_DATA_PATH --chain gemini-3g ...`: start node and store data in `NODE_DATA_PATH` instead of default location
- `./NODE_FILE_NAME purge-chain --base-path NODE_DATA_PATH --chain gemini-3g`: erases data related to the node if data were stored in `NODE_DATA_PATH`

Examples:
```bash
Expand Down

0 comments on commit f8386a5

Please sign in to comment.