Skip to content

Commit 0078462

Browse files
committed
chore(abci): don't panic on unsupported version error
1 parent e4e156c commit 0078462

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

packages/rs-drive-abci/src/error/execution.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ pub enum ExecutionError {
5252
known_versions: Vec<FeatureVersion>,
5353
},
5454

55+
/// We don't have the required protocol version. Most liekly the platform must be upgraded.
56+
#[error("platform protocol version {required} is not supported, max supported is {max_supported}; please upgrade")]
57+
ProtocolVersionNotSupported {
58+
/// The maximum supported protocol version
59+
max_supported: u32,
60+
/// Protocol version requested by the network
61+
required: u32,
62+
},
63+
5564
/// The platform encountered a corrupted cache state error.
5665
#[error("platform corrupted cached state error: {0}")]
5766
CorruptedCachedState(String),

packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,23 @@ where
8383

8484
// We should panic if this node is not supported a new protocol version
8585
let Ok(next_platform_version) = PlatformVersion::get(next_protocol_version) else {
86-
panic!(
86+
let max_supported = PlatformVersion::latest().protocol_version;
87+
tracing::error!(
8788
r#"Failed to upgrade the network protocol version {next_protocol_version}.
8889
8990
Please update your software to the latest version: https://docs.dash.org/platform-protocol-upgrade
9091
9192
Your software version: {}, latest supported protocol version: {}."#,
9293
env!("CARGO_PKG_VERSION"),
93-
PlatformVersion::latest().protocol_version
94+
max_supported
9495
);
96+
97+
return Ok(ValidationResult::new_with_error(Error::Execution(
98+
ExecutionError::ProtocolVersionNotSupported {
99+
max_supported,
100+
required: next_protocol_version,
101+
},
102+
)));
95103
};
96104

97105
let old_protocol_version = block_platform_state.current_protocol_version_in_consensus();

0 commit comments

Comments
 (0)