-
Notifications
You must be signed in to change notification settings - Fork 2.6k
pallet-lottery: add generate_storage_info #10594
pallet-lottery: add generate_storage_info #10594
Conversation
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Lottery pallet is not deployed to any production runtimes, so it should be fine to merge this without any worries about migrations. |
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]>
@@ -442,12 +455,12 @@ impl<T: Config> Pallet<T> { | |||
Error::<T>::AlreadyParticipating |
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.
Using a BoundedSet
here would make matters easier, but I'm not sure if it is worth the refactor rn.
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]>
/benchmark runtime pallet pallet_lottery |
Benchmark Runtime Pallet for branch "lottery-bounded-len" with command cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_lottery --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/lottery/src/weights.rs --template=./.maintain/frame-weight-template.hbs Toolchain: stable-x86_64-unknown-linux-gnu (default) Results
ERROR: Unable to push ./frame/lottery/src/weights.rs |
BoundedVec::<CallIndex, T::MaxCalls>::try_from(vec![ | ||
set_code_index; | ||
T::MaxCalls::get().saturating_sub(1) as usize | ||
], | ||
]).unwrap(), |
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 recently added a bounded_vec!
macro for very basic usages. I think you can easily make it understand vec![_; _]
syntax as well and then use it here.
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 can't find the macro in the code-base, can you point me to it please?
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.
ahh it is in #10601, maybe you can review it ? :p
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.
not a big deal, we can proceed without it.
Would be good if either of us remembers to come clean it up after the aforementioned PR is merged.
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.
Ok thanks.
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.
Some small suggestions, but overall looks good! welcome! 🎉
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
bot merge |
* pallet-preimage: fix crate doc Signed-off-by: Oliver Tale-Yazdi <[email protected]> * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_lottery --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/lottery/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Parity Bot <[email protected]>
* pallet-lottery: add generate_storage_info Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: test call_to_indices with TooManyCalls Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: move try_push above transfer Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: test stop_repeat Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: test do_buy_ticket as white-box Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: use BoundedVec in bechmarks Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: fix zero div panic Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: extend buy_ticket tests Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: test buy_ticket AlreadyParticipating Signed-off-by: Oliver Tale-Yazdi <[email protected]> * fmt Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: use /// comments on private functions Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: use with_bounded_capacity Signed-off-by: Oliver Tale-Yazdi <[email protected]>
) * pallet-preimage: fix crate doc Signed-off-by: Oliver Tale-Yazdi <[email protected]> * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_lottery --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/lottery/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Parity Bot <[email protected]>
* pallet-lottery: add generate_storage_info Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: test call_to_indices with TooManyCalls Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: move try_push above transfer Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: test stop_repeat Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: test do_buy_ticket as white-box Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: use BoundedVec in bechmarks Signed-off-by: Oliver Tale-Yazdi <[email protected]> * pallet-lottery: fix zero div panic Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: extend buy_ticket tests Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: test buy_ticket AlreadyParticipating Signed-off-by: Oliver Tale-Yazdi <[email protected]> * fmt Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: use /// comments on private functions Signed-off-by: Oliver Tale-Yazdi <[email protected]> * review: use with_bounded_capacity Signed-off-by: Oliver Tale-Yazdi <[email protected]>
) * pallet-preimage: fix crate doc Signed-off-by: Oliver Tale-Yazdi <[email protected]> * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_lottery --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/lottery/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Parity Bot <[email protected]>
Adds
generate_storage_info
topallet-lottery
.Related paritytech/polkadot-sdk#323