Skip to content

Commit

Permalink
Merge #3079
Browse files Browse the repository at this point in the history
3079: Fix PoS changes bootstrap panic r=Eitu33 a=Eitu33



Co-authored-by: Thomas Plisson <[email protected]>
  • Loading branch information
bors[bot] and Eitu33 authored Sep 26, 2022
2 parents 88f8331 + 22fa1c6 commit d959563
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/technical-doc/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openrpc": "1.2.4",
"info": {
"title": "Massa OpenRPC",
"version": "TEST.14.7",
"version": "TEST.14.8",
"description": "Massa OpenRPC spec",
"termsOfService": "https://open-rpc.org",
"contact": {
Expand Down
6 changes: 3 additions & 3 deletions docs/testnet/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ From binaries
If you just wish to run a Massa node without compiling it yourself, you
can simply download the latest binary below and go the the next step: :ref:`Running a node <testnet-running>`.

- `Windows executable <https://github.com/massalabs/massa/releases/download/TEST.14.7/massa_TEST.14.7_release_windows.zip>`_
- `Linux binary <https://github.com/massalabs/massa/releases/download/TEST.14.7/massa_TEST.14.7_release_linux.tar.gz>`_ - only works with libc2.28 at least (for example Ubuntu 20.04 and higher)
- `MacOS binary <https://github.com/massalabs/massa/releases/download/TEST.14.7/massa_TEST.14.7_release_macos.tar.gz>`_
- `Windows executable <https://github.com/massalabs/massa/releases/download/TEST.14.8/massa_TEST.14.8_release_windows.zip>`_
- `Linux binary <https://github.com/massalabs/massa/releases/download/TEST.14.8/massa_TEST.14.8_release_linux.tar.gz>`_ - only works with libc2.28 at least (for example Ubuntu 20.04 and higher)
- `MacOS binary <https://github.com/massalabs/massa/releases/download/TEST.14.8/massa_TEST.14.8_release_macos.tar.gz>`_

From source code
================
Expand Down
23 changes: 13 additions & 10 deletions massa-bootstrap/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,26 @@ async fn stream_final_state(
.set_deferred_credits_part(pos_credits_part.as_bytes())?;
let last_exec_ops_step = write_final_state
.executed_ops
.set_executed_ops_part(exec_ops_part.as_bytes(), cfg.thread_count)
.unwrap();
.set_executed_ops_part(exec_ops_part.as_bytes(), cfg.thread_count)?;
for (changes_slot, changes) in final_state_changes.iter() {
write_final_state
.ledger
.apply_changes(changes.ledger_changes.clone(), *changes_slot);
write_final_state
.async_pool
.apply_changes_unchecked(&changes.async_pool_changes);
write_final_state.pos_state.apply_changes(
changes.pos_changes.clone(),
*changes_slot,
false,
)?;
write_final_state
.executed_ops
.extend(changes.executed_ops.clone());
if !changes.pos_changes.is_empty() {
write_final_state.pos_state.apply_changes(
changes.pos_changes.clone(),
*changes_slot,
false,
)?;
}
if !changes.executed_ops.is_empty() {
write_final_state
.executed_ops
.extend(changes.executed_ops.clone());
}
}
write_final_state.slot = slot;
if let BootstrapClientMessage::AskFinalStatePart {
Expand Down
2 changes: 1 addition & 1 deletion massa-models/src/config/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ lazy_static::lazy_static! {
if cfg!(feature = "sandbox") {
"SAND.0.0"
} else {
"TEST.14.7"
"TEST.14.8"
}
.parse()
.unwrap()
Expand Down
4 changes: 4 additions & 0 deletions massa-pos-exports/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use nom::{
};
use num::rational::Ratio;
use std::ops::Bound::{Excluded, Included, Unbounded};
use tracing::warn;

use crate::SelectorController;

Expand Down Expand Up @@ -402,6 +403,9 @@ impl PoSFinalState {
} else {
let opt_next_cycle = self.cycle_history.back().map(|info| info.cycle.saturating_add(1));
if let Some(next_cycle) = opt_next_cycle && cycle.0 != next_cycle {
if self.cycle_history.iter().map(|item| item.cycle).any(|x| x == cycle.0) {
warn!("PoS received cycle ({}) is already owned by the connecting node", cycle.0);
}
panic!("PoS received cycle ({}) should be equal to the next expected cycle ({})", cycle.0, next_cycle);
}
self.cycle_history.push_back(CycleInfo {
Expand Down

0 comments on commit d959563

Please sign in to comment.