-
Notifications
You must be signed in to change notification settings - Fork 2.7k
new pallet: whitelist pallet #10159
new pallet: whitelist pallet #10159
Conversation
|
We have already implemented exactly this in our pallet open-web3-stack/open-runtime-module-library#603 |
ddc71ca to
dd84eda
Compare
0eb5166 to
81d8e9e
Compare
0f0530a to
4fe4ca3
Compare
4fe4ca3 to
4826e1e
Compare
frame/whitelist/src/tests.rs
Outdated
| assert_err!( | ||
| Whitelist::whitelist_call(Origin::signed(1), call_hash), | ||
| DispatchError::BadOrigin, | ||
| ); | ||
|
|
||
| assert!(!Preimage::preimage_requested(&call_hash)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| assert_err!( | |
| Whitelist::whitelist_call(Origin::signed(1), call_hash), | |
| DispatchError::BadOrigin, | |
| ); | |
| assert!(!Preimage::preimage_requested(&call_hash)); | |
| assert_noop!( | |
| Whitelist::whitelist_call(Origin::signed(1), call_hash), | |
| DispatchError::BadOrigin, | |
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more stuff noop below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes should be fixed by 7020ecd
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
|
/bench runtime pallet pallet_whitelist |
|
Benchmark Runtime Pallet for branch "gui-shawntabrizi-preimage-pallet" with command 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 Toolchain: stable-x86_64-unknown-linux-gnu (default) Results |
…--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
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
|
/bench runtime pallet pallet_whitelist |
|
Benchmark Runtime Pallet for branch "gui-shawntabrizi-preimage-pallet" with command 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 Toolchain: stable-x86_64-unknown-linux-gnu (default) Results |
…--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
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
| .ok_or(Error::<T>::UnavailablePreImage)?; | ||
|
|
||
| let call = <T as Config>::Call::decode_all_with_depth_limit( | ||
| sp_api::MAX_EXTRINSIC_DEPTH, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness we may need to add a bench which tests it with nested calls.
Currently we only bench the length of an encoded call, but if nesting is more expensive than length, it would be missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think nesting makes a difference here. The depth limit here is to prevent against stackoverflow and other kinds of call decoding bombs. But the actual computational overhead here should be the same with anything being encoded or decoded really.
And then the weight of the call can help us determine cheaply and ahead of time that the call itself is okay.
|
bot merge |
should be ready, but I need to a final review myself