new pallet: whitelist pallet (#10159)

* pallet whitelist

* refactor a bit

* fmt

* address audit

* improve tests

* return Ok + refund

* add test for dispatching failing

* add dispatch_whitelisted_call_with_preimage

* fmt

* better name

* Consume all data on decode

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add error docs

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove phantom data

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use rust 2021

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update crate features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make compile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_whitelist --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/whitelist/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Bump Preimage max size

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_whitelist --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/whitelist/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Guillaume Thiolliere
2022-03-01 14:31:51 +01:00
committed by GitHub
parent 5ae3ed3b95
commit e71c7b259d
13 changed files with 873 additions and 3 deletions
+11
View File
@@ -1357,6 +1357,15 @@ impl pallet_transaction_storage::Config for Runtime {
type WeightInfo = pallet_transaction_storage::weights::SubstrateWeight<Runtime>;
}
impl pallet_whitelist::Config for Runtime {
type Event = Event;
type Call = Call;
type WhitelistOrigin = EnsureRoot<AccountId>;
type DispatchWhitelistedOrigin = EnsureRoot<AccountId>;
type PreimageProvider = Preimage;
type WeightInfo = pallet_whitelist::weights::SubstrateWeight<Runtime>;
}
construct_runtime!(
pub enum Runtime where
Block = Block,
@@ -1411,6 +1420,7 @@ construct_runtime!(
ChildBounties: pallet_child_bounties,
Referenda: pallet_referenda,
ConvictionVoting: pallet_conviction_voting,
Whitelist: pallet_whitelist,
}
);
@@ -1509,6 +1519,7 @@ mod benches {
[pallet_uniques, Uniques]
[pallet_utility, Utility]
[pallet_vesting, Vesting]
[pallet_whitelist, Whitelist]
);
}