From 81e79600f23d59afb61e60043b625719f807f3a0 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Thu, 19 Sep 2024 20:27:59 +0700 Subject: [PATCH] fix(tests): fix upgrade tests because of 51% limit on v1 (#2151) --- .../check_for_desired_protocol_upgrade/v0/mod.rs | 9 ++++++++- .../tests/strategy_tests/upgrade_fork_tests.rs | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs index ba67c149d5..304b832ca9 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/check_for_desired_protocol_upgrade/v0/mod.rs @@ -20,7 +20,14 @@ impl Platform { { // This is a solution for the emergency update to version 3 // We clean this up immediately though as we transition to check_for_desired_protocol_upgrade_v1 - 51 + u64::min( + 51, + platform_version + .drive_abci + .methods + .protocol_upgrade + .protocol_version_upgrade_percentage_needed, + ) } else { platform_version .drive_abci diff --git a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs index c5065b239f..928fc0a6a7 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/upgrade_fork_tests.rs @@ -10,6 +10,7 @@ mod tests { use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; use dpp::block::extended_epoch_info::v0::ExtendedEpochInfoV0Getters; use dpp::dashcore::hashes::Hash; + use dpp::dashcore::Network::Regtest; use dpp::dashcore::{BlockHash, ChainLock}; use dpp::version::PlatformVersion; use drive::config::DriveConfig; @@ -775,6 +776,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { + network: Regtest, validator_set: ValidatorSetConfig { quorum_size: 40, ..Default::default() @@ -1015,6 +1017,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let mut config = PlatformConfig { + network: Regtest, validator_set: ValidatorSetConfig { quorum_size: 50, ..Default::default()