Remove without_storage_info for messages pallet#1487
Conversation
serban300
left a comment
There was a problem hiding this comment.
Looks good ! I left a couple of comments, but I would be happy to implement them myself if they make sense. It would help me get more familiar with the project.
| ) -> Option<u32> { | ||
| let message_nonce_size = 8; | ||
| /// Returns `None` if size overflows `usize` limits. | ||
| pub fn encoded_size_hint(relayers_entries: usize, messages_count: usize) -> Option<usize> |
There was a problem hiding this comment.
It seems that we're converting this result to u32 very often. We could create a helper type (something like SizeHint(Option<usize>)) and define on it a method for bounding to u32.
There was a problem hiding this comment.
I would rather add method encoded_size_hint_u32 (or something like that instead). But both options are acceptable :)
| @@ -134,12 +138,9 @@ impl messages::ThisChainWithMessages for Millau { | |||
| } | |||
|
|
|||
| fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight> { | |||
There was a problem hiding this comment.
This method seems to have the same implementation everywhere. Would it make sense to define in on the trait ? Of course we would also need to add MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT, EXTRA_STORAGE_PROOF_SIZE and TX_EXTRA_BYTES to the trait definition.
There was a problem hiding this comment.
Yes, I think it worth to have single implementation, thanks! But probably let's not move all chain weight specific constants to the generic trait (ThisChainWithMessages). Some chains still may use different techniques to "estimate" this tx => may even not have such constants. WDYT about:
trait ThisChainWithMessages {
...
type DeliveryTransactionEstimation: DeliveryTransactionEstimation;
...
}
trait DeliveryTransactionEstimation {
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight>;
}
struct BasicDeliveryTransactionEstimation<const MaxDeliverTxWeight:Weight, const ExtraStorageProofSize: u32, const TxExtraBytes: u32>(PhantomData);
impl<const MaxDeliverTxWeight:Weight, const ExtraStorageProofSize: u32, const TxExtraBytes: u32> DeliveryTransactionEstimation for BasicDeliveryTransactionEstimation<...> {
fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight> {
// use consts here
}
}|
|
||
| #[pallet::pallet] | ||
| #[pallet::generate_store(pub(super) trait Store)] | ||
| #[pallet::without_storage_info] |
There was a problem hiding this comment.
For the other pallets could we remove #[pallet::without_storage_info] and use #[pallet::unbounded] on a case by case basis ? I think it would be easier to track the storage variables that are unbounded.
There was a problem hiding this comment.
TBH I don't know what are side effects of that :) So I'd wait and see how do they solve similar problem in the paras pallet (here: https://github.com/paritytech/polkadot/blob/master/runtime/parachains/src/paras/mod.rs#L572)
Thanks you for the review! If you're keen on doing that, you're welcome to open PR, of course :) If not - I could do that myself :) |
Yes, I'd be happy to do that. I'll open a PR. Thanks ! |
|
Posted #1511 as a result of the discussion here. |
* Remove unused trait implementations Signed-off-by: Serban Iorga <serban@parity.io> * Define encoded_size_hint_u32() Signed-off-by: Serban Iorga <serban@parity.io> * Define TransactionEstimationParams trait Signed-off-by: Serban Iorga <serban@parity.io> * Rework TransactionEstimation Signed-off-by: Serban Iorga <serban@parity.io> * Docs + Renamings Signed-off-by: Serban Iorga <serban@parity.io>
|
I can't mark this PR as approved, probably because it's already merged. But from my side we can consider it approved. |
You could just push a commit here #1407 marking said PR as reviewed. |
Oh, ok, makes sense. I'll do that. Thanks ! |
* Bump jsonrpsee to v0.15.1 Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update Cargo.lock Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update cargo.lock Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * client: Upadte jsonrpsee-core from relay-chain-interface Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * update substrate & polkadot * update substrate & polkadot Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
* draft: remove without_storage_info for messages pallet * some cleanup
* Remove unused trait implementations Signed-off-by: Serban Iorga <serban@parity.io> * Define encoded_size_hint_u32() Signed-off-by: Serban Iorga <serban@parity.io> * Define TransactionEstimationParams trait Signed-off-by: Serban Iorga <serban@parity.io> * Rework TransactionEstimation Signed-off-by: Serban Iorga <serban@parity.io> * Docs + Renamings Signed-off-by: Serban Iorga <serban@parity.io>
* draft: remove without_storage_info for messages pallet * some cleanup
* Remove unused trait implementations Signed-off-by: Serban Iorga <serban@parity.io> * Define encoded_size_hint_u32() Signed-off-by: Serban Iorga <serban@parity.io> * Define TransactionEstimationParams trait Signed-off-by: Serban Iorga <serban@parity.io> * Rework TransactionEstimation Signed-off-by: Serban Iorga <serban@parity.io> * Docs + Renamings Signed-off-by: Serban Iorga <serban@parity.io>
related to #1433
Some things are still need to be improved here + it needs testing => draft