From 0c003129fd6f251c47f2417b097a7d5b86f7574b Mon Sep 17 00:00:00 2001 From: Thomas Plisson Date: Fri, 2 Dec 2022 19:36:17 +0100 Subject: [PATCH] Fix executed ops changes bootstrap and properly handle errors --- massa-bootstrap/src/client.rs | 9 +++++++-- massa-models/src/config/constants.rs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/massa-bootstrap/src/client.rs b/massa-bootstrap/src/client.rs index e0a1b36733e..ba6756f9154 100644 --- a/massa-bootstrap/src/client.rs +++ b/massa-bootstrap/src/client.rs @@ -167,10 +167,15 @@ async fn stream_final_state_and_consensus( }; panic!("Bootstrap failed, try to bootstrap again."); } + BootstrapServerMessage::BootstrapError { error } => { + return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, error).into()) + } _ => { - return Err( - std::io::Error::new(std::io::ErrorKind::TimedOut, "bad message").into(), + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidData, + "unexpected message", ) + .into()) } } } diff --git a/massa-models/src/config/constants.rs b/massa-models/src/config/constants.rs index d3a3e3bc1f0..8af8533aa13 100644 --- a/massa-models/src/config/constants.rs +++ b/massa-models/src/config/constants.rs @@ -126,7 +126,7 @@ pub const MAX_DEFERRED_CREDITS_LENGTH: u64 = 10_000; /// Maximum size of executed ops pub const MAX_EXECUTED_OPS_LENGTH: u64 = 1_000; /// Maximum size of executed ops changes -pub const MAX_EXECUTED_OPS_CHANGES_LENGTH: u64 = 1_000; +pub const MAX_EXECUTED_OPS_CHANGES_LENGTH: u64 = 20_000; /// Maximum length of a datastore key pub const MAX_DATASTORE_KEY_LENGTH: u8 = 255; /// Maximum length of an operation datastore key