From 775a0f852ed34f02bafdaadeb7727026551e8b2f Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 9 Oct 2023 10:10:26 +0400 Subject: [PATCH 1/3] joystream-node: embed joystream mainnet chainspec --- bin/node/src/chain_spec/mod.rs | 4 ++++ bin/node/src/command.rs | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/node/src/chain_spec/mod.rs b/bin/node/src/chain_spec/mod.rs index 56969b5736..58051be986 100644 --- a/bin/node/src/chain_spec/mod.rs +++ b/bin/node/src/chain_spec/mod.rs @@ -56,6 +56,10 @@ pub use node_runtime::GenesisConfig; type AccountPublic = ::Signer; +pub fn joystream_mainnet_config() -> Result { + ChainSpec::from_json_bytes(&include_bytes!("../../../../joy-mainnet.json")[..]) +} + /// Node `ChainSpec` extensions. /// /// Additional parameters for some Substrate core modules, diff --git a/bin/node/src/command.rs b/bin/node/src/command.rs index 3660fb2243..e2332993fa 100644 --- a/bin/node/src/command.rs +++ b/bin/node/src/command.rs @@ -63,11 +63,11 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> std::result::Result, String> { let spec = match id { "" => { - return Err( - "Please specify which chain you want to run, e.g. --dev or --chain=local or --chain=prod-test" - .into(), - ) + return Err("Please specify which chain you want to run, + e.g. --chain=joy-mainnet --dev or --chain=local or --chain=prod-test" + .into()) } + "joy-mainnet" => Box::new(chain_spec::joystream_mainnet_config()?), "dev" => Box::new(chain_spec::development_config()), "prod-test" => Box::new(chain_spec::prod_test_config()), "local" => Box::new(chain_spec::local_testnet_config()), From 9d80d6c5e28026542e0489c6380986b63b00fb51 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 9 Oct 2023 10:33:13 +0400 Subject: [PATCH 2/3] joystream-node: bump version to 8.4.0 --- Cargo.lock | 2 +- bin/node/Cargo.toml | 2 +- bin/node/src/command.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f07c0bb100..891b15f830 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2737,7 +2737,7 @@ dependencies = [ [[package]] name = "joystream-node" -version = "8.3.1" +version = "8.4.0" dependencies = [ "assert_cmd", "async-std", diff --git a/bin/node/Cargo.toml b/bin/node/Cargo.toml index 67f861765e..43128a0aa3 100644 --- a/bin/node/Cargo.toml +++ b/bin/node/Cargo.toml @@ -3,7 +3,7 @@ authors = ['Joystream contributors'] build = 'build.rs' edition = '2018' name = 'joystream-node' -version = '8.3.1' +version = '8.4.0' default-run = "joystream-node" [[bin]] diff --git a/bin/node/src/command.rs b/bin/node/src/command.rs index e2332993fa..22e0bd7961 100644 --- a/bin/node/src/command.rs +++ b/bin/node/src/command.rs @@ -63,8 +63,8 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> std::result::Result, String> { let spec = match id { "" => { - return Err("Please specify which chain you want to run, - e.g. --chain=joy-mainnet --dev or --chain=local or --chain=prod-test" + return Err("Please specify which chain you want to run, eg. --dev or + --chain=joy-mainnet or --chain=local or --chain=prod-test" .into()) } "joy-mainnet" => Box::new(chain_spec::joystream_mainnet_config()?), From 949b629fd7dafcbf5614ee9efb322380bc814525 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Tue, 10 Oct 2023 22:15:43 +0400 Subject: [PATCH 3/3] include joy-mainnet.json in joystream-node docker build step, and in runtime code shasum --- joystream-node.Dockerfile | 2 ++ scripts/runtime-code-shasum.sh | 1 + scripts/runtime-code-tarball.sh | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/joystream-node.Dockerfile b/joystream-node.Dockerfile index 8a7407f84f..ede5d8976a 100644 --- a/joystream-node.Dockerfile +++ b/joystream-node.Dockerfile @@ -20,6 +20,7 @@ COPY Cargo.lock . COPY bin ./bin COPY runtime ./runtime COPY runtime-modules ./runtime-modules +COPY joy-mainnet.json . RUN cargo chef prepare --recipe-path /joystream/recipe.json FROM rust AS cacher @@ -38,6 +39,7 @@ COPY Cargo.lock . COPY bin ./bin COPY runtime ./runtime COPY runtime-modules ./runtime-modules +COPY joy-mainnet.json . # Copy over the cached dependencies COPY --from=cacher /joystream/target target COPY --from=cacher $CARGO_HOME $CARGO_HOME diff --git a/scripts/runtime-code-shasum.sh b/scripts/runtime-code-shasum.sh index a9535a1f69..4830864cac 100755 --- a/scripts/runtime-code-shasum.sh +++ b/scripts/runtime-code-shasum.sh @@ -21,6 +21,7 @@ ${TAR} -c --sort=name --owner=root:0 --group=root:0 --mode 644 --mtime='UTC 2020 runtime-modules \ joystream-node.Dockerfile \ bin \ + joy-mainnet.json \ | if [[ -n "$RUNTIME_PROFILE" ]]; then ${SED} '$a'"$RUNTIME_PROFILE"; else tee; fi \ | shasum \ | cut -d " " -f 1 diff --git a/scripts/runtime-code-tarball.sh b/scripts/runtime-code-tarball.sh index 85036beb03..b17b3e0172 100755 --- a/scripts/runtime-code-tarball.sh +++ b/scripts/runtime-code-tarball.sh @@ -9,4 +9,5 @@ tar -czf joystream.tar.gz \ runtime \ runtime-modules \ joystream-node.Dockerfile \ - bin + bin \ + joy-mainnet.json