From c4868d39c80643be0b8fcc4bd6c072d59c4e8ea1 Mon Sep 17 00:00:00 2001 From: FiberMan Date: Fri, 16 Dec 2022 21:07:28 +0100 Subject: [PATCH 1/8] Add Battlepass pallet --- bin/alphaville/runtime/Cargo.toml | 3 +++ bin/alphaville/runtime/src/lib.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/bin/alphaville/runtime/Cargo.toml b/bin/alphaville/runtime/Cargo.toml index ebed637fa9..61738af97c 100644 --- a/bin/alphaville/runtime/Cargo.toml +++ b/bin/alphaville/runtime/Cargo.toml @@ -130,6 +130,7 @@ gamedao-flow = { path = "../../../modules/gamedao-protocol/flow", default-featur gamedao-control = { path = "../../../modules/gamedao-protocol/control", default-features = false } gamedao-signal = { path = "../../../modules/gamedao-protocol/signal", default-features = false } gamedao-sense = { path = "../../../modules/gamedao-protocol/sense", default-features = false } +gamedao-battlepass = { path = "../../../modules/gamedao-protocol/battlepass", default-features = false } [build-dependencies] substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.28" } @@ -234,6 +235,7 @@ std = [ "gamedao-flow/std", "gamedao-control/std", "gamedao-signal/std", + "gamedao-battlepass/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -292,6 +294,7 @@ runtime-benchmarks = [ "gamedao-control/runtime-benchmarks", "gamedao-flow/runtime-benchmarks", "gamedao-signal/runtime-benchmarks", + "gamedao-battlepass/runtime-benchmarks", ] try-runtime = [ "frame-executive/try-runtime", diff --git a/bin/alphaville/runtime/src/lib.rs b/bin/alphaville/runtime/src/lib.rs index 27be70a170..06ced7897f 100644 --- a/bin/alphaville/runtime/src/lib.rs +++ b/bin/alphaville/runtime/src/lib.rs @@ -1799,6 +1799,16 @@ impl gamedao_sense::Config for Runtime { type StringLimit = StringLimit; } +impl gamedao_battlepass::Config for Runtime { + type Event = Event; + type Control = Control; + type Rmrk = RmrkCore; + type StringLimit = StringLimit; + type SymbolLimit = ConstU32<100>; + type PartsLimit = ConstU32<25>; + type MaxResourcesOnMint = ConstU32<100>; +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -1877,6 +1887,7 @@ construct_runtime!( Sense: gamedao_sense, Control: gamedao_control, Signal: gamedao_signal, + Battlepass: gamedao_battlepass, // Zero pallets: // Migration: module_migration, @@ -1990,6 +2001,7 @@ mod benches { [gamedao_control, Control] [gamedao_flow, Flow] [gamedao_signal, Signal] + // [gamedao_battlepass, Battlepass] ); } From 16291caf8bd8493db9ea9905b930c1926411b0b3 Mon Sep 17 00:00:00 2001 From: Volodymyr Brazhnyk Date: Mon, 19 Dec 2022 12:24:36 +0100 Subject: [PATCH 2/8] Add battlepass to the subzero-dev runtime --- bin/subzero-dev/runtime/Cargo.toml | 2 ++ bin/subzero-dev/runtime/src/lib.rs | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/bin/subzero-dev/runtime/Cargo.toml b/bin/subzero-dev/runtime/Cargo.toml index 2f84372d2e..8774384e74 100644 --- a/bin/subzero-dev/runtime/Cargo.toml +++ b/bin/subzero-dev/runtime/Cargo.toml @@ -109,6 +109,7 @@ gamedao-flow = { path = "../../../modules/gamedao-protocol/flow", default-featur gamedao-control = { path = "../../../modules/gamedao-protocol/control", default-features = false } gamedao-signal = { path = "../../../modules/gamedao-protocol/signal", default-features = false } gamedao-sense = { path = "../../../modules/gamedao-protocol/sense", default-features = false } +gamedao-battlepass = { path = "../../../modules/gamedao-protocol/battlepass", default-features = false } [features] default = [ @@ -197,6 +198,7 @@ std = [ "gamedao-flow/std", "gamedao-control/std", "gamedao-signal/std", + "gamedao-battlepass/std", ] runtime-benchmarks = [ diff --git a/bin/subzero-dev/runtime/src/lib.rs b/bin/subzero-dev/runtime/src/lib.rs index ecf9c35a8f..b0f88f26ab 100644 --- a/bin/subzero-dev/runtime/src/lib.rs +++ b/bin/subzero-dev/runtime/src/lib.rs @@ -1075,6 +1075,16 @@ impl gamedao_sense::Config for Runtime { type StringLimit = StringLimit; } +impl gamedao_battlepass::Config for Runtime { + type Event = Event; + type Control = Control; + type Rmrk = RmrkCore; + type StringLimit = StringLimit; + type SymbolLimit = ConstU32<100>; + type PartsLimit = ConstU32<25>; + type MaxResourcesOnMint = ConstU32<100>; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -1143,6 +1153,7 @@ construct_runtime!( Sense: gamedao_sense = 71, Control: gamedao_control = 72, Signal: gamedao_signal = 73, + Battlepass: gamedao_battlepass = 74, } ); From b2bf914aace95b6ab6f9b1322a6f9e38b9659686 Mon Sep 17 00:00:00 2001 From: Volodymyr Brazhnyk Date: Mon, 19 Dec 2022 12:25:32 +0100 Subject: [PATCH 3/8] Update gamedao-protocol submodule version --- modules/gamedao-protocol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gamedao-protocol b/modules/gamedao-protocol index 764f40ce77..e6b8f77f6a 160000 --- a/modules/gamedao-protocol +++ b/modules/gamedao-protocol @@ -1 +1 @@ -Subproject commit 764f40ce77299f7c3a0c817f35d95f64d5d3fa70 +Subproject commit e6b8f77f6ac8f03a814e9907a93e407cfee09219 From 9b65514e475479a25fdefd44ca41bd0590537d0c Mon Sep 17 00:00:00 2001 From: Volodymyr Brazhnyk Date: Mon, 19 Dec 2022 14:12:15 +0100 Subject: [PATCH 4/8] Add subzero-dev dockerfile --- .docker/subzero-dev.Dockerfile | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .docker/subzero-dev.Dockerfile diff --git a/.docker/subzero-dev.Dockerfile b/.docker/subzero-dev.Dockerfile new file mode 100644 index 0000000000..e389d8e222 --- /dev/null +++ b/.docker/subzero-dev.Dockerfile @@ -0,0 +1,61 @@ +# Note: We don't use Alpine and its packaged Rust/Cargo +# because they're too often out of date, +# preventing them from being used to build subzero/Polkadot. + +FROM phusion/baseimage:focal-1.2.0 as baseimage +ENV DEBIAN_FRONTEND=noninteractive + + +RUN apt-get update && \ + apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \ + apt-get install -y cmake pkg-config libssl-dev git clang + +WORKDIR /subzero +COPY . /subzero + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ + export PATH="$PATH:$HOME/.cargo/bin" && \ + rustup toolchain install nightly-2022-06-24 && \ + rustup target add wasm32-unknown-unknown --toolchain nightly-2022-06-24 && \ + rustup default nightly-2022-06-24 &&\ + rustup show + +# ===== STAGE 2 ====== + +FROM baseimage as builder +ARG PROFILE=release + +RUN export PATH="$PATH:$HOME/.cargo/bin" && \ +cargo build "--$PROFILE" + +# ===== STAGE 3 ====== + +FROM phusion/baseimage:focal-1.2.0 +LABEL maintainer="devops@zero.io" +LABEL description="This is the 2nd stage: a very small image where we copy the subzero binary." +ARG PROFILE=release + +RUN mv /usr/share/ca* /tmp && \ + rm -rf /usr/share/* && \ + mv /tmp/ca-certificates /usr/share/ && \ + useradd -m -u 1000 -U -s /bin/sh -d /subzero subzero && \ + mkdir -p /subzero/.local/share/subzero && \ + chown -R subzero:subzero /subzero/.local && \ + ln -s /subzero/.local/share/subzero /data + +COPY --from=builder /subzero/target/$PROFILE/subzero-dev /usr/local/bin +COPY --from=builder /subzero/.docker/chainspec /chainspec + +# checks +RUN ldd /usr/local/bin/subzero-dev && \ + /usr/local/bin/subzero-dev --version + +# Shrinking +# RUN rm -rf /usr/lib/python* && \ +# rm -rf /usr/bin /usr/sbin /usr/share/man + +USER subzero +EXPOSE 30333 9933 9944 9615 +VOLUME ["/data"] + +CMD ["/usr/local/bin/subzero-dev"] From c6b444442eed97f71387e656ee009581cfb9ffe4 Mon Sep 17 00:00:00 2001 From: Volodymyr Brazhnyk Date: Mon, 19 Dec 2022 14:42:43 +0100 Subject: [PATCH 5/8] Bump runtime version 63->64 --- bin/subzero-dev/node/Cargo.toml | 2 +- bin/subzero-dev/runtime/Cargo.toml | 2 +- bin/subzero-dev/runtime/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/subzero-dev/node/Cargo.toml b/bin/subzero-dev/node/Cargo.toml index e22ad96a39..51b59b8ce8 100644 --- a/bin/subzero-dev/node/Cargo.toml +++ b/bin/subzero-dev/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subzero-dev-node" -version = "3.2.63" +version = "3.2.64" authors = ["ZERO "] description = "A substrate node for video games and beyond." license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/bin/subzero-dev/runtime/Cargo.toml b/bin/subzero-dev/runtime/Cargo.toml index 8774384e74..d0e9984a2f 100644 --- a/bin/subzero-dev/runtime/Cargo.toml +++ b/bin/subzero-dev/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subzero-dev-runtime" -version = "3.2.63" +version = "3.2.64" authors = ["ZERO "] license = "GPL-3.0-or-later WITH Classpath-exception-2.0" homepage = "https://zero.io" diff --git a/bin/subzero-dev/runtime/src/lib.rs b/bin/subzero-dev/runtime/src/lib.rs index b0f88f26ab..99b40b0717 100644 --- a/bin/subzero-dev/runtime/src/lib.rs +++ b/bin/subzero-dev/runtime/src/lib.rs @@ -160,7 +160,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("subzero"), impl_name: create_runtime_str!("dev"), authoring_version: 75, - spec_version: 63, + spec_version: 64, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From a188e25c88d7ca61bb20f60d793130df3d9d8017 Mon Sep 17 00:00:00 2001 From: FiberMan Date: Thu, 22 Dec 2022 14:39:34 +0100 Subject: [PATCH 6/8] Bump version to 3.2.66 --- bin/subzero-dev/node/Cargo.toml | 2 +- bin/subzero-dev/runtime/Cargo.toml | 2 +- bin/subzero-dev/runtime/src/lib.rs | 2 +- modules/gamedao-protocol | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/subzero-dev/node/Cargo.toml b/bin/subzero-dev/node/Cargo.toml index 51b59b8ce8..82da4abe7a 100644 --- a/bin/subzero-dev/node/Cargo.toml +++ b/bin/subzero-dev/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subzero-dev-node" -version = "3.2.64" +version = "3.2.66" authors = ["ZERO "] description = "A substrate node for video games and beyond." license = "GPL-3.0-or-later WITH Classpath-exception-2.0" diff --git a/bin/subzero-dev/runtime/Cargo.toml b/bin/subzero-dev/runtime/Cargo.toml index d0e9984a2f..4f4aa61647 100644 --- a/bin/subzero-dev/runtime/Cargo.toml +++ b/bin/subzero-dev/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subzero-dev-runtime" -version = "3.2.64" +version = "3.2.66" authors = ["ZERO "] license = "GPL-3.0-or-later WITH Classpath-exception-2.0" homepage = "https://zero.io" diff --git a/bin/subzero-dev/runtime/src/lib.rs b/bin/subzero-dev/runtime/src/lib.rs index 99b40b0717..95b5e55822 100644 --- a/bin/subzero-dev/runtime/src/lib.rs +++ b/bin/subzero-dev/runtime/src/lib.rs @@ -160,7 +160,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("subzero"), impl_name: create_runtime_str!("dev"), authoring_version: 75, - spec_version: 64, + spec_version: 66, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/modules/gamedao-protocol b/modules/gamedao-protocol index e6b8f77f6a..03fcd977da 160000 --- a/modules/gamedao-protocol +++ b/modules/gamedao-protocol @@ -1 +1 @@ -Subproject commit e6b8f77f6ac8f03a814e9907a93e407cfee09219 +Subproject commit 03fcd977da35851671090805fa577d3299bb0419 From 9534d2b026217c4646f50c3195faaf4fa6b2bbde Mon Sep 17 00:00:00 2001 From: FiberMan Date: Thu, 22 Dec 2022 17:30:59 +0100 Subject: [PATCH 7/8] Fix benchmark build. --- bin/subzero-dev/runtime/Cargo.toml | 1 + bin/subzero/runtime/src/lib.rs | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/subzero-dev/runtime/Cargo.toml b/bin/subzero-dev/runtime/Cargo.toml index 4f4aa61647..f92c27e159 100644 --- a/bin/subzero-dev/runtime/Cargo.toml +++ b/bin/subzero-dev/runtime/Cargo.toml @@ -216,6 +216,7 @@ runtime-benchmarks = [ "pallet-identity/runtime-benchmarks", "pallet-treasury/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", + "pallet-uniques/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", diff --git a/bin/subzero/runtime/src/lib.rs b/bin/subzero/runtime/src/lib.rs index c49729ecce..9ac2d32d55 100644 --- a/bin/subzero/runtime/src/lib.rs +++ b/bin/subzero/runtime/src/lib.rs @@ -1065,10 +1065,6 @@ mod benches { [pallet_timestamp, Timestamp] [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] - [gamedao_flow, Flow] - [gamedao_sense, Sense] - [gamedao_control, Control] - [gamedao_signal, Signal] ); } From a51615fd7e92a1dc192bea459f82b4b7c076baef Mon Sep 17 00:00:00 2001 From: FiberMan Date: Thu, 22 Dec 2022 21:41:23 +0100 Subject: [PATCH 8/8] Reuse rmrk_core constants. --- bin/alphaville/runtime/src/lib.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/alphaville/runtime/src/lib.rs b/bin/alphaville/runtime/src/lib.rs index 06ced7897f..a9ba16e3e1 100644 --- a/bin/alphaville/runtime/src/lib.rs +++ b/bin/alphaville/runtime/src/lib.rs @@ -1483,15 +1483,21 @@ impl pallet_gilt::Config for Runtime { type WeightInfo = pallet_gilt::weights::SubstrateWeight; } +parameter_types! { + pub const PartsLimit: u32 = 25; + pub const CollectionSymbolLimit: u32 = 100; + pub const MaxResourcesOnMint: u32 = 100; +} + impl pallet_rmrk_core::Config for Runtime { type Event = Event; type ProtocolOrigin = frame_system::EnsureRoot; type MaxRecursions = ConstU32<10>; type ResourceSymbolLimit = ConstU32<10>; - type PartsLimit = ConstU32<25>; + type PartsLimit = PartsLimit; type MaxPriorities = ConstU32<25>; - type CollectionSymbolLimit = ConstU32<100>; - type MaxResourcesOnMint = ConstU32<100>; + type CollectionSymbolLimit = CollectionSymbolLimit; + type MaxResourcesOnMint = MaxResourcesOnMint; } parameter_types! { @@ -1804,9 +1810,9 @@ impl gamedao_battlepass::Config for Runtime { type Control = Control; type Rmrk = RmrkCore; type StringLimit = StringLimit; - type SymbolLimit = ConstU32<100>; - type PartsLimit = ConstU32<25>; - type MaxResourcesOnMint = ConstU32<100>; + type SymbolLimit = CollectionSymbolLimit; + type PartsLimit = PartsLimit; + type MaxResourcesOnMint = MaxResourcesOnMint; } construct_runtime!(