Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
mod v0;
mod v1;

use crate::error::execution::ExecutionError;
use crate::error::Error;
Expand All @@ -17,7 +18,8 @@ where
///
/// This function updates both the masternode list and the quorum information in the platform
/// state. It calls the update_masternode_list and update_quorum_info functions to perform
/// the respective updates.
/// the respective updates. From version 1 it first records in Drive, for later steps to
/// read, the Core forks it sees active for the first time.
///
/// # Arguments
///
Expand All @@ -32,7 +34,8 @@ where
/// # Returns
///
/// * Result<(), Error> - Returns Ok(()) if the update is successful. Returns an error if
/// there is a problem updating the masternode list, quorum information, or the state.
/// there is a problem updating the masternode list, quorum information, or the state, and
/// from version 1 if Core cannot tell whether a fork is active.
#[allow(clippy::too_many_arguments)]
pub(crate) fn update_core_info(
&self,
Expand All @@ -59,9 +62,18 @@ where
transaction,
platform_version,
),
1 => self.update_core_info_v1(
platform_state,
block_platform_state,
core_block_height,
is_init_chain,
block_info,
transaction,
platform_version,
),
version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch {
method: "update_core_info".to_string(),
known_versions: vec![0],
known_versions: vec![0, 1],
received: version,
})),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ mod tests {
/// fire RPC calls we haven't set up in the mock.
#[test]
fn v0_returns_ok_when_same_core_height_and_not_init() {
let platform_version = PlatformVersion::latest();
let platform_version = PlatformVersion::get(14).expect("expected protocol version 14");
let platform = TestPlatformBuilder::new()
.with_initial_protocol_version(platform_version.protocol_version)
.build_with_mock_rpc()
.set_genesis_state();

Expand Down Expand Up @@ -125,8 +126,9 @@ mod tests {
fn v0_short_circuit_is_idempotent_when_not_init_chain() {
// Re-confirm that both conditions together are required by running
// the short-circuit case twice; idempotency guards against flakiness.
let platform_version = PlatformVersion::latest();
let platform_version = PlatformVersion::get(14).expect("expected protocol version 14");
let platform = TestPlatformBuilder::new()
.with_initial_protocol_version(platform_version.protocol_version)
.build_with_mock_rpc()
.set_genesis_state();

Expand Down
Loading
Loading