Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
12fe61a9
Commit
12fe61a9
authored
4 years ago
by
Pierre Krieger
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Increase maximum size of transaction notifications (#7993)
parent
4e1f1120
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/client/network/src/protocol.rs
+14
-5
14 additions, 5 deletions
substrate/client/network/src/protocol.rs
substrate/client/network/src/service.rs
+8
-2
8 additions, 2 deletions
substrate/client/network/src/service.rs
with
22 additions
and
7 deletions
substrate/client/network/src/protocol.rs
+
14
−
5
View file @
12fe61a9
...
...
@@ -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
);
/// Maxim
i
m number of known block hashes to keep for a peer.
/// Maxim
u
m number of known block hashes to keep for a peer.
const
MAX_KNOWN_BLOCKS
:
usize
=
1024
;
// ~32kb per peer + LruHashSet overhead
/// Maxim
i
m number of known transaction hashes to keep for a peer.
/// Maxim
u
m 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
;
/// 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 diff is collapsed.
Click to expand it.
substrate/client/network/src/service.rs
+
8
−
2
View file @
12fe61a9
...
...
@@ -82,6 +82,7 @@ use sp_runtime::traits::{Block as BlockT, NumberFor};
use
sp_utils
::
mpsc
::{
tracing_unbounded
,
TracingUnboundedReceiver
,
TracingUnboundedSender
};
use
std
::{
borrow
::
Cow
,
cmp
,
collections
::{
HashMap
,
HashSet
},
convert
::
TryFrom
as
_
,
fs
,
...
...
@@ -310,8 +311,13 @@ impl<B: BlockT + 'static, H: ExHashT> NetworkWorker<B, H> {
.map
(|
cfg
|
usize
::
try_from
(
cfg
.max_notification_size
)
.unwrap_or
(
usize
::
max_value
()));
// A "default" max is added to cover all the other protocols: ping, identify,
// kademlia.
let
default_max
=
1024
*
1024
;
// kademlia, block announces, and transactions.
let
default_max
=
cmp
::
max
(
1024
*
1024
,
usize
::
try_from
(
protocol
::
BLOCK_ANNOUNCES_TRANSACTIONS_SUBSTREAM_SIZE
)
.unwrap_or
(
usize
::
max_value
())
);
iter
::
once
(
default_max
)
.chain
(
requests_max
)
.chain
(
responses_max
)
.chain
(
notifs_max
)
.max
()
.expect
(
"iterator known to always yield at least one element; qed"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment