Skip to content

Remove without_storage_info for messages pallet#1487

Merged
svyatonik merged 2 commits intomasterfrom
remove-without_storage_info-for-messages-pallet
Jul 4, 2022
Merged

Remove without_storage_info for messages pallet#1487
svyatonik merged 2 commits intomasterfrom
remove-without_storage_info-for-messages-pallet

Conversation

@svyatonik
Copy link
Copy Markdown
Contributor

related to #1433

Some things are still need to be improved here + it needs testing => draft

@svyatonik svyatonik added A-chores Something that has to be done, as part of regular maintenance P-Runtime PR-audit-maybe Would be good to have the PR audited, but it doesn't look critical. labels Jul 1, 2022
@svyatonik svyatonik marked this pull request as ready for review July 4, 2022 11:41
@svyatonik svyatonik merged commit 99a8178 into master Jul 4, 2022
@svyatonik svyatonik deleted the remove-without_storage_info-for-messages-pallet branch July 4, 2022 12:05
Copy link
Copy Markdown
Collaborator

@serban300 serban300 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather add method encoded_size_hint_u32 (or something like that instead). But both options are acceptable :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that also works.

@@ -134,12 +138,9 @@ impl messages::ThisChainWithMessages for Millau {
}

fn estimate_delivery_confirmation_transaction() -> MessageTransaction<Weight> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.


#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
#[pallet::without_storage_info]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@svyatonik
Copy link
Copy Markdown
Contributor Author

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.

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 :)

@serban300
Copy link
Copy Markdown
Collaborator

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.

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 !

@serban300 serban300 mentioned this pull request Jul 15, 2022
@serban300
Copy link
Copy Markdown
Collaborator

Posted #1511 as a result of the discussion here.

svyatonik pushed a commit that referenced this pull request Jul 18, 2022
* 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>
@serban300
Copy link
Copy Markdown
Collaborator

I can't mark this PR as approved, probably because it's already merged. But from my side we can consider it approved.

@acatangiu
Copy link
Copy Markdown
Collaborator

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.

@serban300
Copy link
Copy Markdown
Collaborator

serban300 commented Jul 18, 2022

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 !

svyatonik pushed a commit that referenced this pull request Jul 17, 2023
* 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>
serban300 pushed a commit to serban300/parity-bridges-common that referenced this pull request Mar 27, 2024
* draft: remove without_storage_info for messages pallet

* some cleanup
serban300 added a commit to serban300/parity-bridges-common that referenced this pull request Mar 27, 2024
* 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>
serban300 pushed a commit to serban300/parity-bridges-common that referenced this pull request Apr 8, 2024
* draft: remove without_storage_info for messages pallet

* some cleanup
serban300 added a commit to serban300/parity-bridges-common that referenced this pull request Apr 8, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-chores Something that has to be done, as part of regular maintenance P-Runtime PR-audit-maybe Would be good to have the PR audited, but it doesn't look critical.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants