Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Increase maximum size of transaction notifications #7993

Merged
1 commit merged into from
Jan 27, 2021

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Jan 27, 2021

#7925 reduced the maximum notification sizes for transactions to 1MiB.

I didn't realize that, since we're sending runtime upgrades through transactions, 1MiB isn't enough.
This PR bumps this to 16MiB.

@tomaka tomaka added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Jan 27, 2021
@tomaka tomaka requested review from bkchr and mxinden January 27, 2021 09:49
Copy link
Contributor

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Change looks good to me. I don't have an opinion on the constant 16 MiB.

Comment on lines +88 to +89
// Must be equal to `max(MAX_BLOCK_ANNOUNCE_SIZE, MAX_TRANSACTIONS_SIZE)`.
pub(crate) const BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE: u64 = 16 * 1024 * 1024;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Must be equal to `max(MAX_BLOCK_ANNOUNCE_SIZE, MAX_TRANSACTIONS_SIZE)`.
pub(crate) const BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE: u64 = 16 * 1024 * 1024;
pub(crate) const BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE: u64 = [MAX_BLOCK_ANNOUNCE_SIZE, MAX_TRANSACTIONS_SIZE][(MAX_BLOCK_ANNOUNCE_SIZE < MAX_TRANSACTIONS_SIZE) as usize];

Would make the comment obsolete. Not sure it is worth the complexity. See link below for details:

https://stackoverflow.com/questions/53619695/calculating-maximum-value-of-a-set-of-constant-expressions-at-compile-time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Being able to cast a boolean into a usize is completely a hack in my opinion.

///
/// This should be approx. 2 blocks full of transactions for the network to function properly.
const MAX_KNOWN_TRANSACTIONS: usize = 10240; // ~300kb per peer + overhead.

/// Maximim number of transaction validation request we keep at any moment.
/// Maximum allowed size for a block announce.
const MAX_BLOCK_ANNOUNCE_SIZE: u64 = 1024 * 1024;
Copy link
Member

Choose a reason for hiding this comment

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

This means a block can be in maximum 1MIB?

Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly the block announcement can be at most 1 MiB. The block itself will be transferred separately via the block request response protocol.

Copy link
Contributor Author

@tomaka tomaka Jan 27, 2021

Choose a reason for hiding this comment

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

We have this opaque "extra data" field in block announcements that is used in Polkadot, but I have no idea of its purpose nor its size.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh. That isn't used by Polkadot. This is used by Cumulus. 1MIB should be enough. However, we really should make these values here configurable. Because Substrate != Polkadot.

@tomaka
Copy link
Contributor Author

tomaka commented Jan 27, 2021

bot merge

@ghost
Copy link

ghost commented Jan 27, 2021

Trying merge.

@ghost ghost merged commit c003a48 into paritytech:master Jan 27, 2021
@tomaka tomaka deleted the bump-tx-size branch January 27, 2021 10:41
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants