Files
pezkuwi-subxt/Cargo.toml
T
Oliver Tale-Yazdi e53ebd8cd4 [FRAME] Parameters pallet (#2061)
Closes #169  

Fork of the `orml-parameters-pallet` as introduced by
https://github.com/open-web3-stack/open-runtime-module-library/pull/927
(cc @xlc)
It greatly changes how the macros work, but keeps the pallet the same.
The downside of my code is now that it does only support constant keys
in the form of types, not value-bearing keys.
I think this is an acceptable trade off, give that it can be used by
*any* pallet without any changes.

The pallet allows to dynamically set parameters that can be used in
pallet configs while also restricting the updating on a per-key basis.
The rust-docs contains a complete example.

Changes:
- Add `parameters-pallet`
- Use in the kitchensink as demonstration
- Add experimental attribute to define dynamic params in the runtime.
- Adding a bunch of traits to `frame_support::traits::dynamic_params`
that can be re-used by the ORML macros

## Example

First to define the parameters in the runtime file. The syntax is very
explicit about the codec index and errors if there is no.
```rust
#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::<Runtime>))]
pub mod dynamic_params {
	use super::*;

	#[dynamic_pallet_params]
	#[codec(index = 0)]
	pub mod storage {
		/// Configures the base deposit of storing some data.
		#[codec(index = 0)]
		pub static BaseDeposit: Balance = 1 * DOLLARS;

		/// Configures the per-byte deposit of storing some data.
		#[codec(index = 1)]
		pub static ByteDeposit: Balance = 1 * CENTS;
	}

	#[dynamic_pallet_params]
	#[codec(index = 1)]
	pub mod contracts {
		#[codec(index = 0)]
		pub static DepositPerItem: Balance = deposit(1, 0);

		#[codec(index = 1)]
		pub static DepositPerByte: Balance = deposit(0, 1);
	}
}
```

Then the pallet is configured with the aggregate:  
```rust
impl pallet_parameters::Config for Runtime {
	type AggregratedKeyValue = RuntimeParameters;
	type AdminOrigin = EnsureRootWithSuccess<AccountId, ConstBool<true>>;
	...
}
```

And then the parameters can be used in a pallet config:
```rust
impl pallet_preimage::Config for Runtime {
	type DepositBase = dynamic_params::storage::DepositBase;
}
```

A custom origin an be defined like this:  
```rust
pub struct DynamicParametersManagerOrigin;

impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParametersManagerOrigin {
	type Success = ();

	fn try_origin(
		origin: RuntimeOrigin,
		key: &RuntimeParametersKey,
	) -> Result<Self::Success, RuntimeOrigin> {
		match key {
			RuntimeParametersKey::Storage(_) => {
				frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
				return Ok(())
			},
			RuntimeParametersKey::Contract(_) => {
				frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
				return Ok(())
			},
		}
	}

	#[cfg(feature = "runtime-benchmarks")]
	fn try_successful_origin(_key: &RuntimeParametersKey) -> Result<RuntimeOrigin, ()> {
		Ok(RuntimeOrigin::Root)
	}
}
```

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Nikhil Gupta <17176722+gupnik@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: command-bot <>
2024-02-08 18:47:04 +00:00

615 lines
24 KiB
TOML

[workspace.package]
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
repository = "https://github.com/paritytech/polkadot-sdk.git"
license = "GPL-3.0-only"
[workspace]
resolver = "2"
members = [
"bridges/bin/runtime-common",
"bridges/modules/grandpa",
"bridges/modules/messages",
"bridges/modules/parachains",
"bridges/modules/relayers",
"bridges/modules/xcm-bridge-hub",
"bridges/modules/xcm-bridge-hub-router",
"bridges/primitives/chain-asset-hub-rococo",
"bridges/primitives/chain-asset-hub-westend",
"bridges/primitives/chain-bridge-hub-cumulus",
"bridges/primitives/chain-bridge-hub-kusama",
"bridges/primitives/chain-bridge-hub-polkadot",
"bridges/primitives/chain-bridge-hub-rococo",
"bridges/primitives/chain-bridge-hub-westend",
"bridges/primitives/chain-kusama",
"bridges/primitives/chain-polkadot",
"bridges/primitives/chain-polkadot-bulletin",
"bridges/primitives/chain-rococo",
"bridges/primitives/chain-westend",
"bridges/primitives/header-chain",
"bridges/primitives/messages",
"bridges/primitives/parachains",
"bridges/primitives/polkadot-core",
"bridges/primitives/relayers",
"bridges/primitives/runtime",
"bridges/primitives/test-utils",
"bridges/primitives/xcm-bridge-hub",
"bridges/primitives/xcm-bridge-hub-router",
"bridges/snowbridge/pallets/ethereum-client",
"bridges/snowbridge/pallets/ethereum-client/fixtures",
"bridges/snowbridge/pallets/inbound-queue",
"bridges/snowbridge/pallets/inbound-queue/fixtures",
"bridges/snowbridge/pallets/outbound-queue",
"bridges/snowbridge/pallets/outbound-queue/merkle-tree",
"bridges/snowbridge/pallets/outbound-queue/runtime-api",
"bridges/snowbridge/pallets/system",
"bridges/snowbridge/pallets/system/runtime-api",
"bridges/snowbridge/primitives/beacon",
"bridges/snowbridge/primitives/core",
"bridges/snowbridge/primitives/ethereum",
"bridges/snowbridge/primitives/router",
"bridges/snowbridge/runtime/runtime-common",
"bridges/snowbridge/runtime/test-common",
"cumulus/client/cli",
"cumulus/client/collator",
"cumulus/client/consensus/aura",
"cumulus/client/consensus/common",
"cumulus/client/consensus/proposer",
"cumulus/client/consensus/relay-chain",
"cumulus/client/network",
"cumulus/client/parachain-inherent",
"cumulus/client/pov-recovery",
"cumulus/client/relay-chain-inprocess-interface",
"cumulus/client/relay-chain-interface",
"cumulus/client/relay-chain-minimal-node",
"cumulus/client/relay-chain-rpc-interface",
"cumulus/client/service",
"cumulus/pallets/aura-ext",
"cumulus/pallets/collator-selection",
"cumulus/pallets/dmp-queue",
"cumulus/pallets/parachain-system",
"cumulus/pallets/parachain-system/proc-macro",
"cumulus/pallets/session-benchmarking",
"cumulus/pallets/solo-to-para",
"cumulus/pallets/xcm",
"cumulus/pallets/xcmp-queue",
"cumulus/parachain-template/node",
"cumulus/parachain-template/pallets/template",
"cumulus/parachain-template/runtime",
"cumulus/parachains/common",
"cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/bridges/bridge-hub-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/collectives/collectives-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/people/people-westend",
"cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal",
"cumulus/parachains/integration-tests/emulated/chains/relays/rococo",
"cumulus/parachains/integration-tests/emulated/chains/relays/westend",
"cumulus/parachains/integration-tests/emulated/common",
"cumulus/parachains/integration-tests/emulated/networks/rococo-system",
"cumulus/parachains/integration-tests/emulated/networks/rococo-westend-system",
"cumulus/parachains/integration-tests/emulated/networks/westend-system",
"cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo",
"cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend",
"cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo",
"cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend",
"cumulus/parachains/integration-tests/emulated/tests/people/people-rococo",
"cumulus/parachains/integration-tests/emulated/tests/people/people-westend",
"cumulus/parachains/pallets/collective-content",
"cumulus/parachains/pallets/parachain-info",
"cumulus/parachains/pallets/ping",
"cumulus/parachains/runtimes/assets/asset-hub-rococo",
"cumulus/parachains/runtimes/assets/asset-hub-westend",
"cumulus/parachains/runtimes/assets/common",
"cumulus/parachains/runtimes/assets/test-utils",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo",
"cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend",
"cumulus/parachains/runtimes/bridge-hubs/common",
"cumulus/parachains/runtimes/bridge-hubs/test-utils",
"cumulus/parachains/runtimes/collectives/collectives-westend",
"cumulus/parachains/runtimes/constants",
"cumulus/parachains/runtimes/contracts/contracts-rococo",
"cumulus/parachains/runtimes/coretime/coretime-rococo",
"cumulus/parachains/runtimes/coretime/coretime-westend",
"cumulus/parachains/runtimes/glutton/glutton-westend",
"cumulus/parachains/runtimes/people/people-rococo",
"cumulus/parachains/runtimes/people/people-westend",
"cumulus/parachains/runtimes/starters/seedling",
"cumulus/parachains/runtimes/starters/shell",
"cumulus/parachains/runtimes/test-utils",
"cumulus/parachains/runtimes/testing/penpal",
"cumulus/parachains/runtimes/testing/rococo-parachain",
"cumulus/polkadot-parachain",
"cumulus/primitives/aura",
"cumulus/primitives/core",
"cumulus/primitives/parachain-inherent",
"cumulus/primitives/proof-size-hostfunction",
"cumulus/primitives/timestamp",
"cumulus/primitives/utility",
"cumulus/test/client",
"cumulus/test/relay-sproof-builder",
"cumulus/test/runtime",
"cumulus/test/service",
"cumulus/xcm/xcm-emulator",
"docs/sdk",
"polkadot",
"polkadot/cli",
"polkadot/core-primitives",
"polkadot/erasure-coding",
"polkadot/erasure-coding/fuzzer",
"polkadot/node/collation-generation",
"polkadot/node/core/approval-voting",
"polkadot/node/core/av-store",
"polkadot/node/core/backing",
"polkadot/node/core/bitfield-signing",
"polkadot/node/core/candidate-validation",
"polkadot/node/core/chain-api",
"polkadot/node/core/chain-selection",
"polkadot/node/core/dispute-coordinator",
"polkadot/node/core/parachains-inherent",
"polkadot/node/core/prospective-parachains",
"polkadot/node/core/provisioner",
"polkadot/node/core/pvf",
"polkadot/node/core/pvf-checker",
"polkadot/node/core/pvf/common",
"polkadot/node/core/pvf/execute-worker",
"polkadot/node/core/pvf/prepare-worker",
"polkadot/node/core/runtime-api",
"polkadot/node/gum",
"polkadot/node/gum/proc-macro",
"polkadot/node/jaeger",
"polkadot/node/malus",
"polkadot/node/metrics",
"polkadot/node/network/approval-distribution",
"polkadot/node/network/availability-distribution",
"polkadot/node/network/availability-recovery",
"polkadot/node/network/bitfield-distribution",
"polkadot/node/network/bridge",
"polkadot/node/network/collator-protocol",
"polkadot/node/network/dispute-distribution",
"polkadot/node/network/gossip-support",
"polkadot/node/network/protocol",
"polkadot/node/network/statement-distribution",
"polkadot/node/overseer",
"polkadot/node/primitives",
"polkadot/node/service",
"polkadot/node/subsystem",
"polkadot/node/subsystem-bench",
"polkadot/node/subsystem-test-helpers",
"polkadot/node/subsystem-types",
"polkadot/node/subsystem-util",
"polkadot/node/test/client",
"polkadot/node/test/service",
"polkadot/node/tracking-allocator",
"polkadot/node/zombienet-backchannel",
"polkadot/parachain",
"polkadot/parachain/test-parachains",
"polkadot/parachain/test-parachains/adder",
"polkadot/parachain/test-parachains/adder/collator",
"polkadot/parachain/test-parachains/halt",
"polkadot/parachain/test-parachains/undying",
"polkadot/parachain/test-parachains/undying/collator",
"polkadot/primitives",
"polkadot/primitives/test-helpers",
"polkadot/rpc",
"polkadot/runtime/common",
"polkadot/runtime/common/slot_range_helper",
"polkadot/runtime/metrics",
"polkadot/runtime/parachains",
"polkadot/runtime/rococo",
"polkadot/runtime/rococo/constants",
"polkadot/runtime/test-runtime",
"polkadot/runtime/test-runtime/constants",
"polkadot/runtime/westend",
"polkadot/runtime/westend/constants",
"polkadot/statement-table",
"polkadot/utils/generate-bags",
"polkadot/utils/remote-ext-tests/bags-list",
"polkadot/xcm",
"polkadot/xcm/pallet-xcm",
"polkadot/xcm/pallet-xcm-benchmarks",
"polkadot/xcm/procedural",
"polkadot/xcm/xcm-builder",
"polkadot/xcm/xcm-executor",
"polkadot/xcm/xcm-executor/integration-tests",
"polkadot/xcm/xcm-simulator",
"polkadot/xcm/xcm-simulator/example",
"polkadot/xcm/xcm-simulator/fuzzer",
"substrate/bin/minimal/node",
"substrate/bin/minimal/runtime",
"substrate/bin/node-template/node",
"substrate/bin/node-template/pallets/template",
"substrate/bin/node-template/runtime",
"substrate/bin/node/bench",
"substrate/bin/node/cli",
"substrate/bin/node/inspect",
"substrate/bin/node/primitives",
"substrate/bin/node/rpc",
"substrate/bin/node/runtime",
"substrate/bin/node/testing",
"substrate/bin/utils/chain-spec-builder",
"substrate/bin/utils/subkey",
"substrate/client/allocator",
"substrate/client/api",
"substrate/client/authority-discovery",
"substrate/client/basic-authorship",
"substrate/client/block-builder",
"substrate/client/chain-spec",
"substrate/client/chain-spec/derive",
"substrate/client/cli",
"substrate/client/consensus/aura",
"substrate/client/consensus/babe",
"substrate/client/consensus/babe/rpc",
"substrate/client/consensus/beefy",
"substrate/client/consensus/beefy/rpc",
"substrate/client/consensus/common",
"substrate/client/consensus/epochs",
"substrate/client/consensus/grandpa",
"substrate/client/consensus/grandpa/rpc",
"substrate/client/consensus/manual-seal",
"substrate/client/consensus/pow",
"substrate/client/consensus/slots",
"substrate/client/db",
"substrate/client/executor",
"substrate/client/executor/common",
"substrate/client/executor/runtime-test",
"substrate/client/executor/wasmtime",
"substrate/client/informant",
"substrate/client/keystore",
"substrate/client/merkle-mountain-range",
"substrate/client/merkle-mountain-range/rpc",
"substrate/client/mixnet",
"substrate/client/network",
"substrate/client/network-gossip",
"substrate/client/network/bitswap",
"substrate/client/network/common",
"substrate/client/network/light",
"substrate/client/network/statement",
"substrate/client/network/sync",
"substrate/client/network/test",
"substrate/client/network/transactions",
"substrate/client/offchain",
"substrate/client/proposer-metrics",
"substrate/client/rpc",
"substrate/client/rpc-api",
"substrate/client/rpc-servers",
"substrate/client/rpc-spec-v2",
"substrate/client/service",
"substrate/client/service/test",
"substrate/client/state-db",
"substrate/client/statement-store",
"substrate/client/storage-monitor",
"substrate/client/sync-state-rpc",
"substrate/client/sysinfo",
"substrate/client/telemetry",
"substrate/client/tracing",
"substrate/client/tracing/proc-macro",
"substrate/client/transaction-pool",
"substrate/client/transaction-pool/api",
"substrate/client/utils",
"substrate/deprecated/hashing",
"substrate/deprecated/hashing/proc-macro",
"substrate/frame",
"substrate/frame/alliance",
"substrate/frame/asset-conversion",
"substrate/frame/asset-rate",
"substrate/frame/assets",
"substrate/frame/atomic-swap",
"substrate/frame/aura",
"substrate/frame/authority-discovery",
"substrate/frame/authorship",
"substrate/frame/babe",
"substrate/frame/bags-list",
"substrate/frame/bags-list/fuzzer",
"substrate/frame/bags-list/remote-tests",
"substrate/frame/balances",
"substrate/frame/beefy",
"substrate/frame/beefy-mmr",
"substrate/frame/benchmarking",
"substrate/frame/benchmarking/pov",
"substrate/frame/bounties",
"substrate/frame/broker",
"substrate/frame/child-bounties",
"substrate/frame/collective",
"substrate/frame/contracts",
"substrate/frame/contracts/fixtures",
"substrate/frame/contracts/mock-network",
"substrate/frame/contracts/proc-macro",
"substrate/frame/contracts/uapi",
"substrate/frame/conviction-voting",
"substrate/frame/core-fellowship",
"substrate/frame/democracy",
"substrate/frame/election-provider-multi-phase",
"substrate/frame/election-provider-multi-phase/test-staking-e2e",
"substrate/frame/election-provider-support",
"substrate/frame/election-provider-support/benchmarking",
"substrate/frame/election-provider-support/solution-type",
"substrate/frame/election-provider-support/solution-type/fuzzer",
"substrate/frame/elections-phragmen",
"substrate/frame/examples",
"substrate/frame/examples/basic",
"substrate/frame/examples/default-config",
"substrate/frame/examples/dev-mode",
"substrate/frame/examples/frame-crate",
"substrate/frame/examples/kitchensink",
"substrate/frame/examples/offchain-worker",
"substrate/frame/examples/split",
"substrate/frame/examples/tasks",
"substrate/frame/executive",
"substrate/frame/fast-unstake",
"substrate/frame/glutton",
"substrate/frame/grandpa",
"substrate/frame/identity",
"substrate/frame/im-online",
"substrate/frame/indices",
"substrate/frame/insecure-randomness-collective-flip",
"substrate/frame/lottery",
"substrate/frame/membership",
"substrate/frame/merkle-mountain-range",
"substrate/frame/message-queue",
"substrate/frame/mixnet",
"substrate/frame/multisig",
"substrate/frame/nft-fractionalization",
"substrate/frame/nfts",
"substrate/frame/nfts/runtime-api",
"substrate/frame/nis",
"substrate/frame/node-authorization",
"substrate/frame/nomination-pools",
"substrate/frame/nomination-pools/benchmarking",
"substrate/frame/nomination-pools/fuzzer",
"substrate/frame/nomination-pools/runtime-api",
"substrate/frame/nomination-pools/test-staking",
"substrate/frame/offences",
"substrate/frame/offences/benchmarking",
"substrate/frame/paged-list",
"substrate/frame/paged-list/fuzzer",
"substrate/frame/parameters",
"substrate/frame/preimage",
"substrate/frame/proxy",
"substrate/frame/ranked-collective",
"substrate/frame/recovery",
"substrate/frame/referenda",
"substrate/frame/remark",
"substrate/frame/root-offences",
"substrate/frame/root-testing",
"substrate/frame/safe-mode",
"substrate/frame/salary",
"substrate/frame/sassafras",
"substrate/frame/scheduler",
"substrate/frame/scored-pool",
"substrate/frame/session",
"substrate/frame/session/benchmarking",
"substrate/frame/society",
"substrate/frame/staking",
"substrate/frame/staking/reward-curve",
"substrate/frame/staking/reward-fn",
"substrate/frame/staking/runtime-api",
"substrate/frame/state-trie-migration",
"substrate/frame/statement",
"substrate/frame/sudo",
"substrate/frame/support",
"substrate/frame/support/procedural",
"substrate/frame/support/procedural/tools",
"substrate/frame/support/procedural/tools/derive",
"substrate/frame/support/test",
"substrate/frame/support/test/compile_pass",
"substrate/frame/support/test/pallet",
"substrate/frame/support/test/stg_frame_crate",
"substrate/frame/system",
"substrate/frame/system/benchmarking",
"substrate/frame/system/rpc/runtime-api",
"substrate/frame/timestamp",
"substrate/frame/tips",
"substrate/frame/transaction-payment",
"substrate/frame/transaction-payment/asset-conversion-tx-payment",
"substrate/frame/transaction-payment/asset-tx-payment",
"substrate/frame/transaction-payment/rpc",
"substrate/frame/transaction-payment/rpc/runtime-api",
"substrate/frame/transaction-payment/skip-feeless-payment",
"substrate/frame/transaction-storage",
"substrate/frame/treasury",
"substrate/frame/try-runtime",
"substrate/frame/tx-pause",
"substrate/frame/uniques",
"substrate/frame/utility",
"substrate/frame/vesting",
"substrate/frame/whitelist",
"substrate/primitives/api",
"substrate/primitives/api/proc-macro",
"substrate/primitives/api/test",
"substrate/primitives/application-crypto",
"substrate/primitives/application-crypto/test",
"substrate/primitives/arithmetic",
"substrate/primitives/arithmetic/fuzzer",
"substrate/primitives/authority-discovery",
"substrate/primitives/block-builder",
"substrate/primitives/blockchain",
"substrate/primitives/consensus/aura",
"substrate/primitives/consensus/babe",
"substrate/primitives/consensus/beefy",
"substrate/primitives/consensus/common",
"substrate/primitives/consensus/grandpa",
"substrate/primitives/consensus/pow",
"substrate/primitives/consensus/sassafras",
"substrate/primitives/consensus/slots",
"substrate/primitives/core",
"substrate/primitives/core/fuzz",
"substrate/primitives/crypto/ec-utils",
"substrate/primitives/crypto/hashing",
"substrate/primitives/crypto/hashing/proc-macro",
"substrate/primitives/database",
"substrate/primitives/debug-derive",
"substrate/primitives/externalities",
"substrate/primitives/genesis-builder",
"substrate/primitives/inherents",
"substrate/primitives/io",
"substrate/primitives/keyring",
"substrate/primitives/keystore",
"substrate/primitives/maybe-compressed-blob",
"substrate/primitives/merkle-mountain-range",
"substrate/primitives/metadata-ir",
"substrate/primitives/mixnet",
"substrate/primitives/npos-elections",
"substrate/primitives/npos-elections/fuzzer",
"substrate/primitives/offchain",
"substrate/primitives/panic-handler",
"substrate/primitives/rpc",
"substrate/primitives/runtime",
"substrate/primitives/runtime-interface",
"substrate/primitives/runtime-interface/proc-macro",
"substrate/primitives/runtime-interface/test",
"substrate/primitives/runtime-interface/test-wasm",
"substrate/primitives/runtime-interface/test-wasm-deprecated",
"substrate/primitives/session",
"substrate/primitives/staking",
"substrate/primitives/state-machine",
"substrate/primitives/statement-store",
"substrate/primitives/std",
"substrate/primitives/storage",
"substrate/primitives/test-primitives",
"substrate/primitives/timestamp",
"substrate/primitives/tracing",
"substrate/primitives/transaction-pool",
"substrate/primitives/transaction-storage-proof",
"substrate/primitives/trie",
"substrate/primitives/version",
"substrate/primitives/version/proc-macro",
"substrate/primitives/wasm-interface",
"substrate/primitives/weights",
"substrate/scripts/ci/node-template-release",
"substrate/test-utils",
"substrate/test-utils/cli",
"substrate/test-utils/client",
"substrate/test-utils/runtime",
"substrate/test-utils/runtime/client",
"substrate/test-utils/runtime/transaction-pool",
"substrate/utils/binary-merkle-tree",
"substrate/utils/build-script-utils",
"substrate/utils/fork-tree",
"substrate/utils/frame/benchmarking-cli",
"substrate/utils/frame/frame-utilities-cli",
"substrate/utils/frame/generate-bags",
"substrate/utils/frame/generate-bags/node-runtime",
"substrate/utils/frame/remote-externalities",
"substrate/utils/frame/rpc/client",
"substrate/utils/frame/rpc/state-trie-migration-rpc",
"substrate/utils/frame/rpc/support",
"substrate/utils/frame/rpc/system",
"substrate/utils/frame/try-runtime/cli",
"substrate/utils/prometheus",
"substrate/utils/wasm-builder",
]
default-members = ["polkadot", "substrate/bin/node/cli"]
[workspace.lints.rust]
suspicious_double_ref_op = { level = "allow", priority = 2 }
[workspace.lints.clippy]
all = { level = "allow", priority = 0 }
correctness = { level = "warn", priority = 1 }
complexity = { level = "warn", priority = 1 }
if-same-then-else = { level = "allow", priority = 2 }
zero-prefixed-literal = { level = "allow", priority = 2 } # 00_1000_000
type_complexity = { level = "allow", priority = 2 } # raison d'etre
nonminimal-bool = { level = "allow", priority = 2 } # maybe
borrowed-box = { level = "allow", priority = 2 } # Reasonable to fix this one
too-many-arguments = { level = "allow", priority = 2 } # (Turning this on would lead to)
needless-lifetimes = { level = "allow", priority = 2 } # generated code
unnecessary_cast = { level = "allow", priority = 2 } # Types may change
identity-op = { level = "allow", priority = 2 } # One case where we do 0 +
useless_conversion = { level = "allow", priority = 2 } # Types may change
unit_arg = { level = "allow", priority = 2 } # stylistic
option-map-unit-fn = { level = "allow", priority = 2 } # stylistic
bind_instead_of_map = { level = "allow", priority = 2 } # stylistic
erasing_op = { level = "allow", priority = 2 } # E.g. 0 * DOLLARS
eq_op = { level = "allow", priority = 2 } # In tests we test equality.
while_immutable_condition = { level = "allow", priority = 2 } # false positives
needless_option_as_deref = { level = "allow", priority = 2 } # false positives
derivable_impls = { level = "allow", priority = 2 } # false positives
stable_sort_primitive = { level = "allow", priority = 2 } # prefer stable sort
extra-unused-type-parameters = { level = "allow", priority = 2 } # stylistic
default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic
[workspace.dependencies]
polkavm-linker = "0.8.2"
polkavm-derive = "0.8.0"
[profile.release]
# Polkadot runtime requires unwinding.
panic = "unwind"
opt-level = 3
# make sure dev builds with backtrace do not slow us down
[profile.dev.package.backtrace]
inherits = "release"
[profile.production]
inherits = "release"
lto = true
codegen-units = 1
[profile.testnet]
inherits = "release"
debug = 1 # debug symbols are useful for profilers
debug-assertions = true
overflow-checks = true
# The list of dependencies below (which can be both direct and indirect dependencies) are crates
# that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of
# their debug info might be missing) or to require to be frequently recompiled. We compile these
# dependencies with `opt-level=3` even in "dev" mode in order to make "dev" mode more usable.
# The majority of these crates are cryptographic libraries.
#
# If you see an error mentioning "profile package spec ... did not match any packages", it
# probably concerns this list.
#
# This list is ordered alphabetically.
[profile.dev.package]
blake2 = { opt-level = 3 }
blake2b_simd = { opt-level = 3 }
chacha20poly1305 = { opt-level = 3 }
cranelift-codegen = { opt-level = 3 }
cranelift-wasm = { opt-level = 3 }
crc32fast = { opt-level = 3 }
crossbeam-deque = { opt-level = 3 }
crypto-mac = { opt-level = 3 }
curve25519-dalek = { opt-level = 3 }
ed25519-dalek = { opt-level = 3 }
flate2 = { opt-level = 3 }
futures-channel = { opt-level = 3 }
hash-db = { opt-level = 3 }
hashbrown = { opt-level = 3 }
hmac = { opt-level = 3 }
httparse = { opt-level = 3 }
integer-sqrt = { opt-level = 3 }
keccak = { opt-level = 3 }
libm = { opt-level = 3 }
librocksdb-sys = { opt-level = 3 }
libsecp256k1 = { opt-level = 3 }
libz-sys = { opt-level = 3 }
mio = { opt-level = 3 }
nalgebra = { opt-level = 3 }
num-bigint = { opt-level = 3 }
parking_lot = { opt-level = 3 }
parking_lot_core = { opt-level = 3 }
percent-encoding = { opt-level = 3 }
polkavm-linker = { opt-level = 3 }
primitive-types = { opt-level = 3 }
reed-solomon-novelpoly = { opt-level = 3 }
ring = { opt-level = 3 }
rustls = { opt-level = 3 }
sha2 = { opt-level = 3 }
sha3 = { opt-level = 3 }
smallvec = { opt-level = 3 }
snow = { opt-level = 3 }
substrate-bip39 = { opt-level = 3 }
twox-hash = { opt-level = 3 }
uint = { opt-level = 3 }
wasmi = { opt-level = 3 }
x25519-dalek = { opt-level = 3 }
yamux = { opt-level = 3 }
zeroize = { opt-level = 3 }