Skip to content

Commit

Permalink
Merge pull request #2649 from subspace/auto-id-domain-runtime
Browse files Browse the repository at this point in the history
Domains: AutoId domain runtime
  • Loading branch information
vedhavyas authored Apr 3, 2024
2 parents 443b306 + 3d26834 commit 6c357aa
Show file tree
Hide file tree
Showing 10 changed files with 1,068 additions and 21 deletions.
44 changes: 44 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions crates/subspace-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const_assert!(solution_range_to_sectors(sectors_to_solution_range(5)) == 5);

parameter_types! {
pub const Version: RuntimeVersion = VERSION;
pub const BlockHashCount: BlockNumber = 2400;
pub const BlockHashCount: BlockNumber = 250;
/// We allow for 2 seconds of compute with a 6 second average block time.
pub SubspaceBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(BLOCK_WEIGHT_FOR_2_SEC, NORMAL_DISPATCH_RATIO);
/// We allow for 3.75 MiB for `Normal` extrinsic with 5 MiB maximum block length.
Expand Down Expand Up @@ -288,7 +288,7 @@ impl frame_system::Config for Runtime {
/// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = ConstU32<250>;
type BlockHashCount = BlockHashCount;
/// The weight of database operations that the runtime can invoke.
type DbWeight = ParityDbWeight;
/// Version of the runtime.
Expand Down Expand Up @@ -480,7 +480,6 @@ impl pallet_sudo::Config for Runtime {
}

parameter_types! {
pub const RelayConfirmationDepth: BlockNumber = 18;
pub const SelfChainId: ChainId = ChainId::Consensus;
}

Expand Down Expand Up @@ -548,7 +547,6 @@ impl pallet_messenger::Config for Runtime {
}

type Currency = Balances;
type ConfirmationDepth = RelayConfirmationDepth;
type WeightInfo = pallet_messenger::weights::SubstrateWeight<Runtime>;
type WeightToFee = IdentityFee<domain_runtime_primitives::Balance>;
type OnXDMRewards = OnXDMRewards;
Expand Down
2 changes: 0 additions & 2 deletions domains/pallets/messenger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ mod pallet {
type Currency: Mutate<Self::AccountId>
+ InspectHold<Self::AccountId>
+ MutateHold<Self::AccountId>;
/// Confirmation depth for XDM coming from chains.
type ConfirmationDepth: Get<BlockNumberFor<Self>>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
/// Weight to fee conversion.
Expand Down
6 changes: 0 additions & 6 deletions domains/pallets/messenger/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ macro_rules! impl_runtime {
type AccountData = AccountData<Balance>;
}

parameter_types! {
pub const ConfirmedStateRootsBound: u32 = 2;
pub const RelayerConfirmationDepth: u64 = 2;
}

parameter_types! {
pub SelfChainId: ChainId = $chain_id.into();
pub const ChannelReserveFee: Balance = 10;
Expand All @@ -87,7 +82,6 @@ macro_rules! impl_runtime {
type RuntimeEvent = RuntimeEvent;
type SelfChainId = SelfChainId;
type Currency = Balances;
type ConfirmationDepth = RelayerConfirmationDepth;
type WeightInfo = ();
type WeightToFee = frame_support::weights::IdentityFee<u64>;
type OnXDMRewards = ();
Expand Down
117 changes: 117 additions & 0 deletions domains/runtime/auto-id/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
[package]
name = "auto-id-domain-runtime"
version = "0.1.0"
authors = ["Vedhavyas Singareddi<[email protected]>"]
license = "Apache-2.0"
homepage = "https://subspace.network"
repository = "https://github.com/subspace/subspace/"
edition = "2021"
description = "Subspace AutoId domain runtime"
include = [
"/src",
"/build.rs",
"/Cargo.toml",
]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.2.1", default-features = false, features = ["derive"] }
domain-pallet-executive = { version = "0.1.0", path = "../../pallets/executive", default-features = false }
domain-runtime-primitives = { version = "0.1.0", path = "../../primitives/runtime", default-features = false }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
pallet-auto-id = { version = "0.1.0", path = "../../pallets/auto-id", default-features = false }
pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
pallet-block-fees = { version = "0.1.0", path = "../../pallets/block-fees", default-features = false }
pallet-domain-id = { version = "0.1.0", path = "../../pallets/domain-id", default-features = false }
pallet-messenger = { version = "0.1.0", path = "../../pallets/messenger", default-features = false }
pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
pallet-transporter = { version = "0.1.0", path = "../../pallets/transporter", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-domains = { version = "0.1.0", path = "../../../crates/sp-domains", default-features = false }
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-messenger = { version = "0.1.0", default-features = false, path = "../../primitives/messenger" }
sp-messenger-host-functions = { version = "0.1.0", default-features = false, path = "../../primitives/messenger-host-functions" }
sp-mmr-primitives = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-storage = { version = "13.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8", optional = true }
sp-subspace-mmr = { version = "0.1.0", default-features = false, path = "../../../crates/sp-subspace-mmr" }
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-version = { version = "22.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
subspace-core-primitives = { version = "0.1.0", path = "../../../crates/subspace-core-primitives", default-features = false }
subspace-runtime-primitives = { version = "0.1.0", path = "../../../crates/subspace-runtime-primitives", default-features = false }

[dev-dependencies]
subspace-runtime-primitives = { version = "0.1.0", features = ["testing"], path = "../../../crates/subspace-runtime-primitives" }

[build-dependencies]
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8", optional = true }

[features]
default = [
"std",
]
std = [
"codec/std",
"domain-pallet-executive/std",
"domain-runtime-primitives/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"pallet-auto-id/std",
"pallet-balances/std",
"pallet-block-fees/std",
"pallet-domain-id/std",
"pallet-messenger/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transporter/std",
"scale-info/std",
"sp-api/std",
"sp-block-builder/std",
"sp-core/std",
"sp-domains/std",
"sp-inherents/std",
"sp-messenger/std",
"sp-messenger-host-functions/std",
"sp-mmr-primitives/std",
"sp-offchain/std",
"sp-runtime/std",
"sp-session/std",
"sp-std/std",
"sp-storage?/std",
"sp-subspace-mmr/std",
"sp-transaction-pool/std",
"sp-version/std",
"subspace-core-primitives/std",
"subspace-runtime-primitives/std",
"substrate-wasm-builder",
]
runtime-benchmarks = [
"domain-pallet-executive/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-storage",
"frame-benchmarking",
"frame-system-benchmarking",
"frame-system-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
]
12 changes: 12 additions & 0 deletions domains/runtime/auto-id/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fn main() {
#[cfg(feature = "std")]
{
// TODO: Workaround for https://github.com/paritytech/polkadot-sdk/issues/3192
std::env::set_var("CFLAGS", "-mcpu=mvp");
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build();
}
}
Loading

0 comments on commit 6c357aa

Please sign in to comment.