Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ members = [
"worker/common",
"worker/native",
"worker/protocol/dart-v1",
"worker/protocol/testing",
"pallets/asset",
"pallets/base",
"pallets/committee",
Expand Down Expand Up @@ -118,6 +119,8 @@ members = [
"pallets/treasury",
"pallets/utility",
"pallets/weights",
"pallets/worker-modules",
"pallets/worker-modules/worker-testing",
"primitives",
"primitives_derive",
"primitives/asset-metadata",
Expand All @@ -143,6 +146,7 @@ polymesh-worker-extension = { path = "worker/extension", default-features = fals
polymesh-worker-common = { path = "worker/common", default-features = false }
polymesh-worker-native = { path = "worker/native", default-features = false }
polymesh-worker-protocol-dart-v1 = { path = "worker/protocol/dart-v1", default-features = false }
polymesh-worker-protocol-testing = { path = "worker/protocol/testing", default-features = false }
schnellru = { version = "0.2.4", default-features = false }
rayon = { version = "1.8" }

Expand Down Expand Up @@ -178,6 +182,8 @@ polymesh-transaction-payment = { path = "pallets/transaction-payment", default-f
pallet-treasury = { path = "pallets/treasury", default-features = false }
pallet-utility = { path = "pallets/utility", default-features = false }
polymesh-contracts = { path = "pallets/contracts", default-features = false }
pallet-worker-modules = { path = "pallets/worker-modules", default-features = false }
pallet-worker-testing = { path = "pallets/worker-modules/worker-testing", default-features = false }

# Common
polymesh-runtime-common = { path = "pallets/runtime/common", default-features = false }
Expand Down
11 changes: 11 additions & 0 deletions pallets/runtime/common/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,17 @@ macro_rules! misc_pallet_impls {
type MaxServiceWeight = MbmServiceWeight;
type WeightInfo = polymesh_weights::pallet_migrations::SubstrateWeight;
}

pub type MaxModuleCodeSize = polymesh_primitives::ConstSize<{ 2 * 1024 * 1024 }>; // 2 MiB
pub type MaxModuleContextSize = polymesh_primitives::ConstSize<{ 2 * 1024 * 1024 }>; // 2 MiB
pub type MaxModulesPerConfig = polymesh_primitives::ConstSize<4>; // 4 modules per config

impl pallet_worker_modules::Config for Runtime {
type WeightInfo = pallet_worker_modules::weights::SubstrateWeight;
type MaxModuleCodeSize = MaxModuleCodeSize;
type MaxModuleContextSize = MaxModuleContextSize;
type MaxModulesPerConfig = MaxModulesPerConfig;
}
};
}

Expand Down
7 changes: 7 additions & 0 deletions pallets/runtime/develop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pallet-statistics = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-worker-modules = { workspace = true, default-features = false }
pallet-worker-testing = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }

Expand Down Expand Up @@ -129,6 +131,7 @@ no_std = [
"polymesh-primitives/no_std",
"u64_backend",
"pallet-confidential-assets/no_std",
"pallet-worker-testing/no_std",
"polymesh-dart/no_std",
]

Expand Down Expand Up @@ -175,6 +178,8 @@ std = [
"pallet-transaction-payment/std",
"polymesh-transaction-payment/std",
"pallet-utility/std",
"pallet-worker-modules/std",
"pallet-worker-testing/std",
"pallet-validators/std",
"polymesh-contracts/std",
"polymesh-runtime-common/std",
Expand Down Expand Up @@ -229,6 +234,8 @@ runtime-benchmarks = [
"polymesh-transaction-payment/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-worker-modules/runtime-benchmarks",
"pallet-worker-testing/runtime-benchmarks",
"pallet-validators/runtime-benchmarks",
"polymesh-contracts/runtime-benchmarks",
"polymesh-runtime-common/runtime-benchmarks",
Expand Down
11 changes: 11 additions & 0 deletions pallets/runtime/develop/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,13 +534,23 @@ mod runtime {
#[runtime::pallet_index(55)]
pub type MultiBlockMigrations = pallet_migrations::Pallet<Runtime>;

#[runtime::pallet_index(60)]
pub type WorkerModules = pallet_worker_modules::Pallet<Runtime>;

#[runtime::pallet_index(200)]
pub type WorkerTesting = pallet_worker_testing::Pallet<Runtime>;

#[runtime::pallet_index(70)]
pub type ConfidentialAssets = pallet_confidential_assets::Pallet<Runtime>;

#[runtime::pallet_index(80)]
pub type Revive = pallet_revive::Pallet<Runtime>;
}

impl pallet_worker_testing::Config for Runtime {
type WeightInfo = pallet_worker_testing::weights::SubstrateWeight;
}

impl pallet_confidential_assets::Config for Runtime {
type Currency = Balances;

Expand Down Expand Up @@ -590,6 +600,7 @@ mod benches {
[pallet_corporate_ballot, CorporateBallot]
[pallet_capital_distribution, CapitalDistribution]
[pallet_confidential_assets, ConfidentialAssets]
[pallet_worker_modules, WorkerModules]
[pallet_external_agents, ExternalAgents]
[pallet_relayer, Relayer]
[pallet_committee, PolymeshCommittee]
Expand Down
3 changes: 3 additions & 0 deletions pallets/runtime/mainnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pallet-sto = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-worker-modules = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }

Expand Down Expand Up @@ -173,6 +174,7 @@ std = [
"polymesh-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"pallet-worker-modules/std",
"polymesh-contracts/std",
"polymesh-primitives/std",
"polymesh-runtime-common/std",
Expand Down Expand Up @@ -230,6 +232,7 @@ runtime-benchmarks = [
"polymesh-transaction-payment/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-worker-modules/runtime-benchmarks",
"pallet-validators/runtime-benchmarks",
"polymesh-contracts/runtime-benchmarks",
"polymesh-runtime-common/runtime-benchmarks",
Expand Down
3 changes: 3 additions & 0 deletions pallets/runtime/mainnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ mod runtime {
#[runtime::pallet_index(55)]
pub type MultiBlockMigrations = pallet_migrations::Pallet<Runtime>;

#[runtime::pallet_index(60)]
pub type WorkerModules = pallet_worker_modules::Pallet<Runtime>;

#[runtime::pallet_index(80)]
pub type Revive = pallet_revive::Pallet<Runtime>;
}
Expand Down
3 changes: 3 additions & 0 deletions pallets/runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pallet-sto = { workspace = true, default-features = false }
pallet-transaction-payment = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-worker-modules = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }

Expand Down Expand Up @@ -182,6 +183,7 @@ std = [
"polymesh-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"pallet-worker-modules/std",
"polymesh-contracts/std",
"polymesh-primitives/std",
"polymesh-runtime-common/std",
Expand Down Expand Up @@ -241,6 +243,7 @@ runtime-benchmarks = [
"polymesh-transaction-payment/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-worker-modules/runtime-benchmarks",
"pallet-validators/runtime-benchmarks",
"polymesh-contracts/runtime-benchmarks",
"polymesh-runtime-common/runtime-benchmarks",
Expand Down
3 changes: 3 additions & 0 deletions pallets/runtime/testnet/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ mod runtime {
#[runtime::pallet_index(55)]
pub type MultiBlockMigrations = pallet_migrations::Pallet<Runtime>;

#[runtime::pallet_index(60)]
pub type WorkerModules = pallet_worker_modules::Pallet<Runtime>;

#[runtime::pallet_index(70)]
pub type ConfidentialAssets = pallet_confidential_assets::Pallet<Runtime>;

Expand Down
1 change: 1 addition & 0 deletions pallets/runtime/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pallet-transaction-payment = { workspace = true, default-features = false }
polymesh-transaction-payment = { workspace = true, default-features = false }
pallet-treasury = { workspace = true, default-features = false }
pallet-utility = { workspace = true, default-features = false }
pallet-worker-modules = { workspace = true, default-features = false }
polymesh-contracts = { workspace = true, default-features = false }
polymesh-primitives = { workspace = true, default-features = false }
polymesh-runtime-common = { workspace = true, default-features = false }
Expand Down
64 changes: 64 additions & 0 deletions pallets/worker-modules/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[package]
name = "pallet-worker-modules"
version.workspace = true
authors.workspace = true
license-file.workspace = true
edition.workspace = true
repository.workspace = true
homepage.workspace = true

[dependencies]
# Common
polymesh-primitives = { workspace = true, default-features = false }

# Workers
polymesh-worker-extension = { workspace = true, default-features = false }
polymesh-worker-common = { workspace = true, default-features = false, features = ["serde"] }

# Other
serde = { version = "1.0.104", default-features = false }

# Substrate
codec = { workspace = true, default-features = false, features = ["derive"] }
scale-info = { workspace = true, default-features = false, features = [
"derive",
] }
frame-system = { workspace = true, default-features = false }
frame-support = { workspace = true, default-features = false }
sp-std = { workspace = true, default-features = false }
sp-io = { workspace = true, default-features = false }
sp-runtime = { workspace = true, default-features = false }

# Only Benchmarking
frame-benchmarking = { workspace = true, default-features = false, optional = true }

log = { version = "0.4", default-features = false }

[features]
equalize = []
default = ["std", "equalize"]

testing = ["polymesh-worker-extension/testing", "polymesh-worker-common/testing"]

no_std = []
std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"frame-benchmarking?/std",
"polymesh-primitives/std",
"polymesh-worker-extension/std",
"polymesh-worker-common/std",
"sp-runtime/std",
"sp-std/std",
"sp-io/std",
"serde/std",
]
runtime-benchmarks = [
"testing",
"frame-benchmarking/runtime-benchmarks",
"polymesh-primitives/runtime-benchmarks",
"polymesh-worker-extension/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = []
Loading