-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Increase maximum size of transaction notifications #7993
Conversation
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.
Change looks good to me. I don't have an opinion on the constant 16 MiB.
// Must be equal to `max(MAX_BLOCK_ANNOUNCE_SIZE, MAX_TRANSACTIONS_SIZE)`. | ||
pub(crate) const BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE: u64 = 16 * 1024 * 1024; |
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.
// 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:
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.
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; |
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.
This means a block can be in maximum 1MIB?
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.
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.
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.
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.
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. 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.
bot merge |
Trying merge. |
#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.