Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up decoding of known-len component of messages between bootstrap client/server #3881

Merged
merged 29 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3519398
Use dedicated deserializer for client-binder msg receive
Ben-PH Apr 28, 2023
125c1f3
Use helper method to decode data in known-len component of msg frm cl…
Ben-PH Apr 28, 2023
e64dd15
In client-binder, use helper method instead of a dedicated deser-struct
Ben-PH Apr 28, 2023
7ae357b
Remove redundant TODO
Ben-PH Apr 28, 2023
ca3a5c6
Bootstrap/constify (#3883)
Ben-PH Apr 28, 2023
03321ee
Use timeout-updating read-loop. Use peek_exact_timeout helper
Ben-PH Apr 28, 2023
ad38081
Send message to client in single write_all
Ben-PH Apr 28, 2023
d7c46a0
Document new helper methods
Ben-PH Apr 28, 2023
89b5c60
Make the servers `send_timeout` more readable
Ben-PH Apr 28, 2023
4aff56a
Revert the use of peek to a read-exact
Ben-PH May 3, 2023
041662c
Use traits to implement read_exact without code duplication
Ben-PH May 3, 2023
4c7a5b5
Remove unused peek implementation
Ben-PH May 3, 2023
01fa710
Comment the new methods
Ben-PH May 3, 2023
d006490
Clear clippy lints
Ben-PH May 3, 2023
472ed63
Client sends message in a single write
Ben-PH May 3, 2023
9c6055c
Implement and use the traits for the server binder
Ben-PH May 3, 2023
5676e9b
Module rearrangement
Ben-PH May 3, 2023
17eafbd
Merge remote-tracking branch 'origin/testnet_22' into bootstrap/use-r…
Ben-PH May 3, 2023
93c43a3
`cargo fmt --all`
Ben-PH May 3, 2023
c92b93d
Self review
Ben-PH May 3, 2023
35a5c2d
Merge remote-tracking branch 'origin/testnet_22' into bootstrap/messa…
Ben-PH May 3, 2023
497e76e
Merge remote-tracking branch 'origin/bootstrap/use-read-loop' into bo…
Ben-PH May 3, 2023
9e5abd5
Delete file that somehow missed the deletion-memo
Ben-PH May 4, 2023
9f8bd55
Merge branch 'testnet_23' into bootstrap/message-deser
Ben-PH May 4, 2023
54aa34c
Clear clippy lints
Ben-PH May 4, 2023
9b867ed
Merge branch 'testnet_23' into bootstrap/message-deser
Ben-PH May 4, 2023
0102c2e
rename peek and friends to reflect the reversion of peek usage
Ben-PH May 4, 2023
3f7b7b4
Use read_exact_timeout (should have been included in use-read-loop)
Ben-PH May 4, 2023
ff7a558
Use an in-file constant for compile-time known values
Ben-PH May 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions massa-bootstrap/src/bindings/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::messages::{
};
use crate::settings::BootstrapClientConfig;
use massa_hash::Hash;
use massa_models::config::{MAX_BOOTSTRAP_MESSAGE_SIZE, MAX_BOOTSTRAP_MESSAGE_SIZE_BYTES};
use massa_models::serialization::{DeserializeMinBEInt, SerializeMinBEInt};
use massa_models::version::{Version, VersionSerializer};
use massa_serialization::{DeserializeError, Deserializer, Serializer};
Expand All @@ -18,15 +19,20 @@ use std::{io::Write, net::TcpStream, time::Duration};

/// Bootstrap client binder
pub struct BootstrapClientBinder {
// max_bootstrap_message_size: u32,
size_field_len: usize,
remote_pubkey: PublicKey,
duplex: TcpStream,
prev_message: Option<Hash>,
version_serializer: VersionSerializer,
cfg: BootstrapClientConfig,
}

const KNOWN_PREFIX_LEN: usize = SIGNATURE_SIZE_BYTES + MAX_BOOTSTRAP_MESSAGE_SIZE_BYTES;
/// The known-length component of a message to be received.
struct ServerMessageLeader {
sig: Signature,
msg_len: u32,
}

impl BootstrapClientBinder {
/// Creates a new `WriteBinder`.
///
Expand All @@ -35,9 +41,7 @@ impl BootstrapClientBinder {
/// * limit: limit max bytes per second (up and down)
#[allow(clippy::too_many_arguments)]
pub fn new(duplex: TcpStream, remote_pubkey: PublicKey, cfg: BootstrapClientConfig) -> Self {
let size_field_len = u32::be_bytes_min_length(cfg.max_bootstrap_message_size);
BootstrapClientBinder {
size_field_len,
remote_pubkey,
duplex,
prev_message: None,
Expand Down Expand Up @@ -67,7 +71,6 @@ impl BootstrapClientBinder {
Ok(())
}

// TODO: use a proper (de)serializer: https://github.com/massalabs/massa/pull/3745#discussion_r1169733161
/// Reads the next message.
pub fn next_timeout(
&mut self,
Expand All @@ -76,24 +79,12 @@ impl BootstrapClientBinder {
let deadline = duration.map(|d| Instant::now() + d);

// read the known-len component of the message
let known_len = SIGNATURE_SIZE_BYTES + self.size_field_len;
let mut known_len_buff = vec![0u8; known_len];
let mut known_len_buff = [0u8; KNOWN_PREFIX_LEN];
// TODO: handle a partial read
self.read_exact_timeout(&mut known_len_buff, deadline)
.map_err(|(err, _consumed)| err)?;

// construct the signature
let sig_array = known_len_buff.as_slice()[0..SIGNATURE_SIZE_BYTES]
.try_into()
.expect("logic error in array manipulations");
let sig = Signature::from_bytes(&sig_array)?;

// construct the message len from the peek
let msg_len = u32::from_be_bytes_min(
&known_len_buff[SIGNATURE_SIZE_BYTES..],
self.cfg.max_bootstrap_message_size,
)?
.0;
let ServerMessageLeader { sig, msg_len } = self.decode_msg_leader(&known_len_buff)?;

// Update this bindings "most recently received" message hash, retaining the replaced value
let message_deserializer = BootstrapServerMessageDeserializer::new((&self.cfg).into());
Expand Down Expand Up @@ -180,7 +171,7 @@ impl BootstrapClientBinder {

// Provide the message length
self.duplex.set_write_timeout(duration)?;
let msg_len_bytes = msg_len.to_be_bytes_min(self.cfg.max_bootstrap_message_size)?;
let msg_len_bytes = msg_len.to_be_bytes_min(MAX_BOOTSTRAP_MESSAGE_SIZE)?;
write_buf.extend(&msg_len_bytes);

// Provide the message
Expand All @@ -190,6 +181,26 @@ impl BootstrapClientBinder {
self.duplex.write_all(&write_buf)?;
Ok(())
}

/// We are using this instead of of our library deserializer as the process is relatively straight forward
/// and makes error-type management cleaner
fn decode_msg_leader(
&self,
leader_buff: &[u8; SIGNATURE_SIZE_BYTES + MAX_BOOTSTRAP_MESSAGE_SIZE_BYTES],
) -> Result<ServerMessageLeader, BootstrapError> {
let sig_array = leader_buff[0..SIGNATURE_SIZE_BYTES]
.try_into()
.expect("logic error in array manipulations");
let sig = Signature::from_bytes(&sig_array)?;

// construct the message len from the leader-bufff
let msg_len = u32::from_be_bytes_min(
&leader_buff[SIGNATURE_SIZE_BYTES..],
MAX_BOOTSTRAP_MESSAGE_SIZE,
)?
.0;
Ok(ServerMessageLeader { sig, msg_len })
}
}

impl crate::bindings::BindingReadExact for BootstrapClientBinder {
Expand Down
77 changes: 45 additions & 32 deletions massa-bootstrap/src/bindings/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::messages::{
use crate::settings::BootstrapSrvBindCfg;
use massa_hash::Hash;
use massa_hash::HASH_SIZE_BYTES;
use massa_models::config::{MAX_BOOTSTRAP_MESSAGE_SIZE, MAX_BOOTSTRAP_MESSAGE_SIZE_BYTES};
use massa_models::serialization::{DeserializeMinBEInt, SerializeMinBEInt};
use massa_models::version::{Version, VersionDeserializer, VersionSerializer};
use massa_serialization::{DeserializeError, Deserializer, Serializer};
Expand All @@ -25,14 +26,19 @@ use std::{
};
use tracing::error;

const KNOWN_PREFIX_LEN: usize = HASH_SIZE_BYTES + MAX_BOOTSTRAP_MESSAGE_SIZE_BYTES;
/// The known-length component of a message to be received.
struct ClientMessageLeader {
received_prev_hash: Option<Hash>,
msg_len: u32,
}

/// Bootstrap server binder
pub struct BootstrapServerBinder {
max_bootstrap_message_size: u32,
max_consensus_block_ids: u64,
thread_count: u8,
max_datastore_key_length: u8,
randomness_size_bytes: usize,
size_field_len: usize,
local_keypair: KeyPair,
// TODO: Reintroduce bandwidth limits
duplex: TcpStream,
Expand All @@ -54,18 +60,14 @@ impl BootstrapServerBinder {
let BootstrapSrvBindCfg {
// TODO: Reintroduce bandwidth limits
max_bytes_read_write: _limit,
max_bootstrap_message_size,
thread_count,
max_datastore_key_length,
randomness_size_bytes,
consensus_bootstrap_part_size,
write_error_timeout,
} = cfg;
let size_field_len = u32::be_bytes_min_length(max_bootstrap_message_size);
BootstrapServerBinder {
max_bootstrap_message_size,
max_consensus_block_ids: consensus_bootstrap_part_size,
size_field_len,
local_keypair,
duplex,
prev_message: None,
Expand Down Expand Up @@ -171,7 +173,6 @@ impl BootstrapServerBinder {
})
}

// TODO: use a proper (de)serializer: https://github.com/massalabs/massa/pull/3745#discussion_r1169733161
/// Writes the next message.
pub fn send_timeout(
&mut self,
Expand Down Expand Up @@ -201,7 +202,7 @@ impl BootstrapServerBinder {
};

// construct msg length, and convert to bytes
let msg_len_bytes = msg_len.to_be_bytes_min(self.max_bootstrap_message_size)?;
let msg_len_bytes = msg_len.to_be_bytes_min(MAX_BOOTSTRAP_MESSAGE_SIZE)?;

// organize the bytes into a sendable array
let stream_data = [sig.to_bytes().as_slice(), &msg_len_bytes, &msg_bytes].concat();
Expand All @@ -224,37 +225,20 @@ impl BootstrapServerBinder {
) -> Result<BootstrapClientMessage, BootstrapError> {
let deadline = duration.map(|d| Instant::now() + d);

let known_len = HASH_SIZE_BYTES + self.size_field_len;
let mut known_len_buf = vec![0; known_len];
let mut known_len_buf = vec![0; KNOWN_PREFIX_LEN];
// TODO: handle a partial read
self.read_exact_timeout(&mut known_len_buf, deadline)
.map_err(|(err, _consumed)| err)?;

// construct prev-hash from peek
let received_prev_hash = {
if self.prev_message.is_some() {
Some(Hash::from_bytes(
known_len_buf[..HASH_SIZE_BYTES]
.try_into()
.expect("bad slice logic"),
))
} else {
None
}
};

// construct msg-len from peek
let msg_len = {
u32::from_be_bytes_min(
&known_len_buf[HASH_SIZE_BYTES..],
self.max_bootstrap_message_size,
)?
.0
};
let ClientMessageLeader {
received_prev_hash,
msg_len,
} = self.decode_message_leader(&known_len_buf)?;

// read the rest of the message
let mut msg_bytes = vec![0u8; msg_len as usize];
self.duplex.read_exact(&mut msg_bytes)?;
self.read_exact_timeout(&mut msg_bytes, deadline)
.map_err(|(err, _consumed)| err)?;
Comment on lines +240 to +241
Copy link
Contributor Author

Choose a reason for hiding this comment

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

piggy backing off this PR: This change should have been part of #3885


// check previous hash
if received_prev_hash != self.prev_message {
Expand Down Expand Up @@ -287,6 +271,35 @@ impl BootstrapServerBinder {

Ok(msg)
}

/// We are using this instead of of our library deserializer as the process is relatively straight forward
/// and makes error-type management cleaner
fn decode_message_leader(
&self,
leader_buf: &[u8],
) -> Result<ClientMessageLeader, BootstrapError> {
// construct prev-hash
let received_prev_hash = {
if self.prev_message.is_some() {
Some(Hash::from_bytes(
leader_buf[..HASH_SIZE_BYTES]
.try_into()
.expect("bad slice logic"),
))
} else {
None
}
};

// construct msg-len
let msg_len = {
u32::from_be_bytes_min(&leader_buf[HASH_SIZE_BYTES..], MAX_BOOTSTRAP_MESSAGE_SIZE)?.0
};
Ok(ClientMessageLeader {
received_prev_hash,
msg_len,
})
}
}

impl io::Read for BootstrapServerBinder {
Expand Down
4 changes: 0 additions & 4 deletions massa-bootstrap/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ pub struct BootstrapConfig {
pub ip_list_max_size: usize,
/// Read-Write limitation for a connection in bytes per seconds
pub max_bytes_read_write: f64,
/// max bootstrap message size in bytes
pub max_bootstrap_message_size: u32,
/// thread count
pub thread_count: u8,
/// period per cycle
Expand Down Expand Up @@ -141,7 +139,6 @@ pub struct BootstrapConfig {
#[parent(type = "BootstrapConfig")]
pub struct BootstrapSrvBindCfg {
pub max_bytes_read_write: f64,
pub max_bootstrap_message_size: u32,
pub thread_count: u8,
pub max_datastore_key_length: u8,
pub randomness_size_bytes: usize,
Expand All @@ -155,7 +152,6 @@ pub struct BootstrapSrvBindCfg {
#[parent(type = "BootstrapConfig")]
pub struct BootstrapClientConfig {
pub max_bytes_read_write: f64,
pub max_bootstrap_message_size: u32,
pub endorsement_count: u32,
pub max_listeners_per_peer: u32,
pub max_advertise_length: u32,
Expand Down
17 changes: 6 additions & 11 deletions massa-bootstrap/src/tests/binders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ use massa_models::config::{
BOOTSTRAP_RANDOMNESS_SIZE_BYTES, CONSENSUS_BOOTSTRAP_PART_SIZE, ENDORSEMENT_COUNT,
MAX_ADVERTISE_LENGTH, MAX_ASYNC_MESSAGE_DATA, MAX_ASYNC_POOL_LENGTH,
MAX_BOOTSTRAP_ASYNC_POOL_CHANGES, MAX_BOOTSTRAP_BLOCKS, MAX_BOOTSTRAP_ERROR_LENGTH,
MAX_BOOTSTRAP_FINAL_STATE_PARTS_SIZE, MAX_BOOTSTRAP_MESSAGE_SIZE, MAX_DATASTORE_ENTRY_COUNT,
MAX_DATASTORE_KEY_LENGTH, MAX_DATASTORE_VALUE_LENGTH, MAX_DEFERRED_CREDITS_LENGTH,
MAX_DENUNCIATIONS_PER_BLOCK_HEADER, MAX_DENUNCIATION_CHANGES_LENGTH,
MAX_EXECUTED_OPS_CHANGES_LENGTH, MAX_EXECUTED_OPS_LENGTH, MAX_LEDGER_CHANGES_COUNT,
MAX_LISTENERS_PER_PEER, MAX_OPERATIONS_PER_BLOCK, MAX_PRODUCTION_STATS_LENGTH,
MAX_ROLLS_COUNT_LENGTH, MIP_STORE_STATS_BLOCK_CONSIDERED, MIP_STORE_STATS_COUNTERS_MAX,
THREAD_COUNT,
MAX_BOOTSTRAP_FINAL_STATE_PARTS_SIZE, MAX_DATASTORE_ENTRY_COUNT, MAX_DATASTORE_KEY_LENGTH,
MAX_DATASTORE_VALUE_LENGTH, MAX_DEFERRED_CREDITS_LENGTH, MAX_DENUNCIATIONS_PER_BLOCK_HEADER,
MAX_DENUNCIATION_CHANGES_LENGTH, MAX_EXECUTED_OPS_CHANGES_LENGTH, MAX_EXECUTED_OPS_LENGTH,
MAX_LEDGER_CHANGES_COUNT, MAX_LISTENERS_PER_PEER, MAX_OPERATIONS_PER_BLOCK,
MAX_PRODUCTION_STATS_LENGTH, MAX_ROLLS_COUNT_LENGTH, MIP_STORE_STATS_BLOCK_CONSIDERED,
MIP_STORE_STATS_COUNTERS_MAX, THREAD_COUNT,
};
use massa_models::node::NodeId;
use massa_models::version::Version;
Expand All @@ -38,7 +37,6 @@ impl BootstrapClientBinder {
pub fn test_default(client_duplex: TcpStream, remote_pubkey: PublicKey) -> Self {
let cfg = BootstrapClientConfig {
max_bytes_read_write: f64::INFINITY,
max_bootstrap_message_size: MAX_BOOTSTRAP_MESSAGE_SIZE,
max_listeners_per_peer: MAX_LISTENERS_PER_PEER as u32,
endorsement_count: ENDORSEMENT_COUNT,
max_advertise_length: MAX_ADVERTISE_LENGTH,
Expand Down Expand Up @@ -84,7 +82,6 @@ fn test_binders() {
server_keypair.clone(),
BootstrapSrvBindCfg {
max_bytes_read_write: f64::INFINITY,
max_bootstrap_message_size: MAX_BOOTSTRAP_MESSAGE_SIZE,
thread_count: THREAD_COUNT,
max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH,
randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES,
Expand Down Expand Up @@ -235,7 +232,6 @@ fn test_binders_double_send_server_works() {
server_keypair.clone(),
BootstrapSrvBindCfg {
max_bytes_read_write: f64::INFINITY,
max_bootstrap_message_size: MAX_BOOTSTRAP_MESSAGE_SIZE,
thread_count: THREAD_COUNT,
max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH,
randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES,
Expand Down Expand Up @@ -367,7 +363,6 @@ fn test_binders_try_double_send_client_works() {
server_keypair.clone(),
BootstrapSrvBindCfg {
max_bytes_read_write: f64::INFINITY,
max_bootstrap_message_size: MAX_BOOTSTRAP_MESSAGE_SIZE,
thread_count: THREAD_COUNT,
max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH,
randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES,
Expand Down
18 changes: 8 additions & 10 deletions massa-bootstrap/src/tests/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ use massa_models::config::{
BOOTSTRAP_RANDOMNESS_SIZE_BYTES, CONSENSUS_BOOTSTRAP_PART_SIZE, ENDORSEMENT_COUNT,
MAX_ADVERTISE_LENGTH, MAX_ASYNC_MESSAGE_DATA, MAX_ASYNC_POOL_LENGTH,
MAX_BOOTSTRAP_ASYNC_POOL_CHANGES, MAX_BOOTSTRAP_BLOCKS, MAX_BOOTSTRAP_ERROR_LENGTH,
MAX_BOOTSTRAP_FINAL_STATE_PARTS_SIZE, MAX_BOOTSTRAP_MESSAGE_SIZE, MAX_CONSENSUS_BLOCKS_IDS,
MAX_DATASTORE_ENTRY_COUNT, MAX_DATASTORE_KEY_LENGTH, MAX_DATASTORE_VALUE_LENGTH,
MAX_DEFERRED_CREDITS_LENGTH, MAX_DENUNCIATIONS_PER_BLOCK_HEADER,
MAX_DENUNCIATION_CHANGES_LENGTH, MAX_EXECUTED_OPS_CHANGES_LENGTH, MAX_EXECUTED_OPS_LENGTH,
MAX_FUNCTION_NAME_LENGTH, MAX_LEDGER_CHANGES_COUNT, MAX_OPERATIONS_PER_BLOCK,
MAX_OPERATION_DATASTORE_ENTRY_COUNT, MAX_OPERATION_DATASTORE_KEY_LENGTH,
MAX_OPERATION_DATASTORE_VALUE_LENGTH, MAX_PARAMETERS_SIZE, MAX_PRODUCTION_STATS_LENGTH,
MAX_ROLLS_COUNT_LENGTH, MIP_STORE_STATS_BLOCK_CONSIDERED, MIP_STORE_STATS_COUNTERS_MAX,
PERIODS_PER_CYCLE, THREAD_COUNT,
MAX_BOOTSTRAP_FINAL_STATE_PARTS_SIZE, MAX_CONSENSUS_BLOCKS_IDS, MAX_DATASTORE_ENTRY_COUNT,
MAX_DATASTORE_KEY_LENGTH, MAX_DATASTORE_VALUE_LENGTH, MAX_DEFERRED_CREDITS_LENGTH,
MAX_DENUNCIATIONS_PER_BLOCK_HEADER, MAX_DENUNCIATION_CHANGES_LENGTH,
MAX_EXECUTED_OPS_CHANGES_LENGTH, MAX_EXECUTED_OPS_LENGTH, MAX_FUNCTION_NAME_LENGTH,
MAX_LEDGER_CHANGES_COUNT, MAX_OPERATIONS_PER_BLOCK, MAX_OPERATION_DATASTORE_ENTRY_COUNT,
MAX_OPERATION_DATASTORE_KEY_LENGTH, MAX_OPERATION_DATASTORE_VALUE_LENGTH, MAX_PARAMETERS_SIZE,
MAX_PRODUCTION_STATS_LENGTH, MAX_ROLLS_COUNT_LENGTH, MIP_STORE_STATS_BLOCK_CONSIDERED,
MIP_STORE_STATS_COUNTERS_MAX, PERIODS_PER_CYCLE, THREAD_COUNT,
};
use massa_models::denunciation::DenunciationIndex;
use massa_models::node::NodeId;
Expand Down Expand Up @@ -342,7 +341,6 @@ pub fn get_bootstrap_config(bootstrap_public_key: NodeId) -> BootstrapConfig {
ip_list_max_size: 10,
per_ip_min_interval: 10000.into(),
max_bytes_read_write: std::f64::INFINITY,
max_bootstrap_message_size: MAX_BOOTSTRAP_MESSAGE_SIZE,
max_datastore_key_length: MAX_DATASTORE_KEY_LENGTH,
randomness_size_bytes: BOOTSTRAP_RANDOMNESS_SIZE_BYTES,
thread_count: THREAD_COUNT,
Expand Down
8 changes: 7 additions & 1 deletion massa-models/src/config/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
//! (`default_testing.rs`) But as for the current file you shouldn't modify it.
use std::str::FromStr;

use crate::{address::ADDRESS_SIZE_BYTES, amount::Amount, version::Version};
use crate::{
address::ADDRESS_SIZE_BYTES, amount::Amount, serialization::u32_be_bytes_min_length,
version::Version,
};
use massa_signature::KeyPair;
use massa_time::MassaTime;
use num::rational::Ratio;
Expand Down Expand Up @@ -195,6 +198,9 @@ pub const MAX_RNG_SEED_LENGTH: u32 = PERIODS_PER_CYCLE.saturating_mul(THREAD_COU

/// Max message size for bootstrap
pub const MAX_BOOTSTRAP_MESSAGE_SIZE: u32 = 1048576000;
/// The number of bytes needed to encode [`MAX_BOOTSTRAP_MESSAGE_SIZE`]
pub const MAX_BOOTSTRAP_MESSAGE_SIZE_BYTES: usize =
u32_be_bytes_min_length(MAX_BOOTSTRAP_MESSAGE_SIZE);
/// Max number of blocks we provide/ take into account while bootstrapping
pub const MAX_BOOTSTRAP_BLOCKS: u32 = 1000000;
/// max bootstrapped cliques
Expand Down
Loading