This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Increase maximum size of transaction notifications #7993
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,14 +72,23 @@ const TICK_TIMEOUT: time::Duration = time::Duration::from_millis(1100); | |||||||
| /// Interval at which we propagate transactions; | ||||||||
| const PROPAGATE_TIMEOUT: time::Duration = time::Duration::from_millis(2900); | ||||||||
|
|
||||||||
| /// Maximim number of known block hashes to keep for a peer. | ||||||||
| /// Maximum number of known block hashes to keep for a peer. | ||||||||
| const MAX_KNOWN_BLOCKS: usize = 1024; // ~32kb per peer + LruHashSet overhead | ||||||||
| /// Maximim number of known transaction hashes to keep for a peer. | ||||||||
| /// Maximum number of known transaction hashes to keep for a peer. | ||||||||
| /// | ||||||||
| /// 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; | ||||||||
| /// Maximum allowed size for a transactions notification. | ||||||||
| const MAX_TRANSACTIONS_SIZE: u64 = 16 * 1024 * 1024; | ||||||||
|
|
||||||||
| /// Maximum size used for notifications in the block announce and transaction protocols. | ||||||||
| // Must be equal to `max(MAX_BLOCK_ANNOUNCE_SIZE, MAX_TRANSACTIONS_SIZE)`. | ||||||||
| pub(crate) const BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE: u64 = 16 * 1024 * 1024; | ||||||||
|
Comment on lines
+88
to
+89
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Would make the comment obsolete. Not sure it is worth the complexity. See link below for details:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||||
|
|
||||||||
| /// Maximum number of transaction validation request we keep at any moment. | ||||||||
| const MAX_PENDING_TRANSACTIONS: usize = 8192; | ||||||||
|
|
||||||||
| /// Current protocol version. | ||||||||
|
|
@@ -483,8 +492,8 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> { | |||||||
| versions, | ||||||||
| build_status_message::<B>(&config, best_number, best_hash, genesis_hash), | ||||||||
| peerset, | ||||||||
| iter::once((block_announces_protocol, block_announces_handshake, 1024 * 1024)) | ||||||||
| .chain(iter::once((transactions_protocol, vec![], 1024 * 1024))) | ||||||||
| iter::once((block_announces_protocol, block_announces_handshake, MAX_BLOCK_ANNOUNCE_SIZE)) | ||||||||
| .chain(iter::once((transactions_protocol, vec![], MAX_TRANSACTIONS_SIZE))) | ||||||||
| .chain(network_config.extra_sets.iter().map(|s| ( | ||||||||
| s.notifications_protocol.clone(), | ||||||||
| handshake_message.clone(), | ||||||||
|
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.