From fd4db5ab84446fadb3f37faab2e5e88929ac0d09 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 24 Nov 2023 15:56:29 +0700 Subject: [PATCH 01/51] work on added 400/60 quorums to platform state --- packages/rs-drive-abci/src/config.rs | 32 ++++++++--- .../engine/finalize_block_proposal/v0/mod.rs | 2 +- .../update_quorum_info/v0/mod.rs | 53 ++++++++++++------ .../withdrawals/check_withdrawals/v0/mod.rs | 2 +- packages/rs-drive-abci/src/mimic/mod.rs | 2 +- .../src/platform_types/platform_state/mod.rs | 55 +++++++++++++------ .../platform_types/platform_state/v0/mod.rs | 42 ++++++++++++++ .../data_contract/v0/mod.rs | 2 +- .../data_contract_history/v0/mod.rs | 2 +- .../data_contracts/v0/mod.rs | 2 +- .../src/query/document_query/v0/mod.rs | 2 +- .../identity_based_queries/balance/v0/mod.rs | 2 +- .../balance_and_revision/v0/mod.rs | 2 +- .../identities/v0/mod.rs | 2 +- .../identities_by_public_key_hashes/v0/mod.rs | 2 +- .../identity_based_queries/identity/v0/mod.rs | 2 +- .../identity_by_public_key_hash/v0/mod.rs | 2 +- .../identity_based_queries/keys/v0/mod.rs | 2 +- .../rs-drive-abci/src/query/proofs/v0/mod.rs | 2 +- .../src/query/system/epoch_infos/v0/mod.rs | 2 +- .../system/version_upgrade_state/v0/mod.rs | 2 +- .../version_upgrade_vote_status/v0/mod.rs | 2 +- .../tests/strategy_tests/execution.rs | 2 +- 23 files changed, 160 insertions(+), 60 deletions(-) diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index f325924e25f..667aa1b7489 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -190,7 +190,10 @@ pub struct PlatformConfig { pub execution: ExecutionConfig, /// The default quorum type - pub quorum_type: String, + pub validator_set_quorum_type: String, + + /// The quorum type used for verifying chain locks + pub chain_lock_quorum_type: String, /// The default quorum size pub quorum_size: u16, @@ -237,15 +240,30 @@ impl PlatformConfig { } /// Return type of quorum - pub fn quorum_type(&self) -> QuorumType { - let found = if let Ok(t) = self.quorum_type.trim().parse::() { + pub fn validator_set_quorum_type(&self) -> QuorumType { + let found = if let Ok(t) = self.validator_set_quorum_type.trim().parse::() { + QuorumType::from(t) + } else { + QuorumType::from(self.validator_set_quorum_type.as_str()) + }; + + if found == QuorumType::UNKNOWN { + panic!("config: unsupported QUORUM_TYPE: {}", self.validator_set_quorum_type); + } + + found + } + + /// Return type of quorum for validating chain locks + pub fn chain_lock_quorum_type(&self) -> QuorumType { + let found = if let Ok(t) = self.chain_lock_quorum_type.trim().parse::() { QuorumType::from(t) } else { - QuorumType::from(self.quorum_type.as_str()) + QuorumType::from(self.chain_lock_quorum_type.as_str()) }; if found == QuorumType::UNKNOWN { - panic!("config: unsupported QUORUM_TYPE: {}", self.quorum_type); + panic!("config: unsupported QUORUM_TYPE: {}", self.chain_lock_quorum_type); } found @@ -289,7 +307,7 @@ impl Default for ExecutionConfig { impl Default for PlatformConfig { fn default() -> Self { Self { - quorum_type: "llmq_100_67".to_string(), + validator_set_quorum_type: "llmq_100_67".to_string(), quorum_size: 100, block_spacing_ms: 5000, drive: Default::default(), @@ -361,7 +379,7 @@ mod tests { let config = super::PlatformConfig::from_env().expect("expected config from env"); assert!(config.execution.verify_sum_trees); - assert_ne!(config.quorum_type(), QuorumType::UNKNOWN); + assert_ne!(config.validator_set_quorum_type(), QuorumType::UNKNOWN); for id in vectors { matches!(config.abci.log[id.0].destination, LogDestination::Bytes); } diff --git a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs index 0063cd57363..32c64ea8105 100644 --- a/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/finalize_block_proposal/v0/mod.rs @@ -152,7 +152,7 @@ where { // Verify commit - let quorum_type = self.config.quorum_type(); + let quorum_type = self.config.validator_set_quorum_type(); let commit = Commit::new_from_cleaned( commit_info.clone(), block_id, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index e28f3de6c45..72a0d2e1496 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -54,13 +54,16 @@ where .core_rpc .get_quorum_listextended(Some(core_block_height))?; + let validator_set_quorum_type = self.config.validator_set_quorum_type(); + let chain_lock_quorum_type = self.config.chain_lock_quorum_type(); + let validator_quorums_list: BTreeMap<_, _> = extended_quorum_list .quorums_by_type - .remove(&self.config.quorum_type()) + .remove(&validator_set_quorum_type) .ok_or(Error::Execution(ExecutionError::DashCoreBadResponseError( format!( "expected quorums of type {}, but did not receive any from Dash Core", - self.config.quorum_type + self.config.validator_set_quorum_type ), )))? .into_iter() @@ -71,17 +74,6 @@ where .validator_sets_mut() .retain(|quorum_hash, _| { let has_quorum = validator_quorums_list.contains_key::(quorum_hash); - - if has_quorum { - tracing::trace!( - ?quorum_hash, - quorum_type = ?self.config.quorum_type(), - "remove validator set {} with quorum type {}", - quorum_hash, - self.config.quorum_type() - ) - } - has_quorum }); @@ -96,7 +88,7 @@ where .map(|(key, _)| { let quorum_info_result = self.core_rpc - .get_quorum_info(self.config.quorum_type(), key, None)?; + .get_quorum_info(self.config.validator_set_quorum_type(), key, None)?; Ok((*key, quorum_info_result)) }) @@ -124,10 +116,10 @@ where tracing::trace!( ?validator_set, ?quorum_hash, - quorum_type = ?self.config.quorum_type(), + quorum_type = ?self.config.validator_set_quorum_type(), "add new validator set {} with quorum type {}", quorum_hash, - self.config.quorum_type() + self.config.validator_set_quorum_type() ); Ok((quorum_hash, validator_set)) @@ -154,6 +146,35 @@ where } }); + if validator_set_quorum_type == chain_lock_quorum_type { + // Remove validator_sets entries that are no longer valid for the core block height + block_platform_state + .chain_lock_validating_quorums_mut() + .retain(|quorum_hash, _| { + let has_quorum = validator_quorums_list.contains_key::(quorum_hash); + has_quorum + }); + } else { + let chain_lock_quorums_list: BTreeMap<_, _> = extended_quorum_list + .quorums_by_type + .remove(&chain_lock_quorum_type) + .ok_or(Error::Execution(ExecutionError::DashCoreBadResponseError( + format!( + "expected quorums of type {}, but did not receive any from Dash Core", + self.config.chain_lock_quorum_type + ), + )))? + .into_iter() + .collect(); + + block_platform_state + .chain_lock_validating_quorums_mut() + .retain(|quorum_hash, _| { + let has_quorum = chain_lock_quorums_list.contains_key::(quorum_hash); + has_quorum + }); + } + if tracing::enabled!(tracing::Level::TRACE) { tracing::trace!( method = "update_quorum_info_v0", diff --git a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs index 7c7594d1bb3..32a957cf4f0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/withdrawals/check_withdrawals/v0/mod.rs @@ -53,7 +53,7 @@ where let quorum_hash = quorum_hash.expect("quorum hash is required to verify signature"); let validation_result = received_withdrawals.verify_signatures( &self.config.abci.chain_id, - self.config.quorum_type(), + self.config.validator_set_quorum_type(), quorum_hash, height, round, diff --git a/packages/rs-drive-abci/src/mimic/mod.rs b/packages/rs-drive-abci/src/mimic/mod.rs index 16d05c16847..3065a1cf292 100644 --- a/packages/rs-drive-abci/src/mimic/mod.rs +++ b/packages/rs-drive-abci/src/mimic/mod.rs @@ -308,7 +308,7 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { // We need to sign the block - let quorum_type = self.platform.config.quorum_type(); + let quorum_type = self.platform.config.validator_set_quorum_type(); let state_id_hash = state_id .sha256(CHAIN_ID, height as i64, round as i32) .expect("cannot calculate state id hash"); diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index d4b08b9ecb8..a416e77e8a7 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -27,6 +27,7 @@ use crate::error::execution::ExecutionError; use dpp::block::block_info::BlockInfo; use dpp::util::hash::hash; use std::collections::BTreeMap; +use dpp::bls_signatures::{PublicKey as ThresholdBlsPublicKey}; /// Platform state #[derive(Clone, Debug, From)] @@ -276,12 +277,6 @@ impl PlatformStateV0Methods for PlatformState { } } - fn epoch_ref(&self) -> &Epoch { - match self { - PlatformState::V0(v0) => v0.epoch_ref(), - } - } - fn hpmn_list_len(&self) -> usize { match self { PlatformState::V0(v0) => v0.hpmn_list_len(), @@ -294,15 +289,15 @@ impl PlatformStateV0Methods for PlatformState { } } - fn current_protocol_version_in_consensus(&self) -> ProtocolVersion { + fn last_committed_block_info(&self) -> &Option { match self { - PlatformState::V0(v0) => v0.current_protocol_version_in_consensus(), + PlatformState::V0(v0) => &v0.last_committed_block_info, } } - fn last_committed_block_info(&self) -> &Option { + fn current_protocol_version_in_consensus(&self) -> ProtocolVersion { match self { - PlatformState::V0(v0) => &v0.last_committed_block_info, + PlatformState::V0(v0) => v0.current_protocol_version_in_consensus(), } } @@ -324,12 +319,24 @@ impl PlatformStateV0Methods for PlatformState { } } + fn take_next_validator_set_quorum_hash(&mut self) -> Option { + match self { + PlatformState::V0(v0) => v0.take_next_validator_set_quorum_hash(), + } + } + fn validator_sets(&self) -> &IndexMap { match self { PlatformState::V0(v0) => &v0.validator_sets, } } + fn chain_lock_validating_quorums(&self) -> &IndexMap { + match self { + PlatformState::V0(v0) => &v0.chain_lock_validating_quorums, + } + } + fn full_masternode_list(&self) -> &BTreeMap { match self { PlatformState::V0(v0) => &v0.full_masternode_list, @@ -348,6 +355,12 @@ impl PlatformStateV0Methods for PlatformState { } } + fn any_block_info(&self) -> &BlockInfo { + match self { + PlatformState::V0(v0) => v0.any_block_info(), + } + } + fn set_last_committed_block_info(&mut self, info: Option) { match self { PlatformState::V0(v0) => v0.set_last_committed_block_info(info), @@ -384,6 +397,12 @@ impl PlatformStateV0Methods for PlatformState { } } + fn set_chain_lock_validating_quorums(&mut self, quorums: IndexMap) { + match self { + PlatformState::V0(v0) => v0.set_chain_lock_validating_quorums(quorums), + } + } + fn set_full_masternode_list(&mut self, list: BTreeMap) { match self { PlatformState::V0(v0) => v0.set_full_masternode_list(list), @@ -438,6 +457,12 @@ impl PlatformStateV0Methods for PlatformState { } } + fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap { + match self { + PlatformState::V0(v0) => v0.chain_lock_validating_quorums_mut(), + } + } + fn full_masternode_list_mut(&mut self) -> &mut BTreeMap { match self { PlatformState::V0(v0) => v0.full_masternode_list_mut(), @@ -450,9 +475,9 @@ impl PlatformStateV0Methods for PlatformState { } } - fn take_next_validator_set_quorum_hash(&mut self) -> Option { + fn epoch_ref(&self) -> &Epoch { match self { - PlatformState::V0(v0) => v0.take_next_validator_set_quorum_hash(), + PlatformState::V0(v0) => v0.epoch_ref(), } } @@ -461,10 +486,4 @@ impl PlatformStateV0Methods for PlatformState { PlatformState::V0(v0) => v0.last_block_id_hash(), } } - - fn any_block_info(&self) -> &BlockInfo { - match self { - PlatformState::V0(v0) => v0.any_block_info(), - } - } } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index b15dce4743d..9ebff07682e 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -20,6 +20,7 @@ use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; use std::collections::BTreeMap; use std::fmt::{Debug, Formatter}; +use dpp::bls_signatures::{PublicKey as ThresholdBlsPublicKey}; /// Platform state #[derive(Clone)] @@ -41,6 +42,9 @@ pub struct PlatformStateV0 { /// all members pub validator_sets: IndexMap, + /// The current 400 60 quorums used for validating chain locks + pub chain_lock_validating_quorums: BTreeMap, + /// current full masternode list pub full_masternode_list: BTreeMap, @@ -111,6 +115,10 @@ pub(super) struct PlatformStateForSavingV0 { #[bincode(with_serde)] pub validator_sets: Vec<(Bytes32, ValidatorSet)>, + /// The 400 60 quorums used for validating chain locks + #[bincode(with_serde)] + pub chain_lock_validating_quorums: Vec<(Bytes32, ThresholdBlsPublicKey)>, + /// current full masternode list pub full_masternode_list: BTreeMap, @@ -140,6 +148,11 @@ impl TryFrom for PlatformStateForSavingV0 { .into_iter() .map(|(k, v)| (k.to_byte_array().into(), v)) .collect(), + chain_lock_validating_quorums: value + .chain_lock_validating_quorums + .into_iter() + .map(|(k, v)| (k.to_byte_array().into(), v)) + .collect(), full_masternode_list: value .full_masternode_list .into_iter() @@ -182,6 +195,11 @@ impl From for PlatformStateV0 { .into_iter() .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) .collect(), + chain_lock_validating_quorums: value + .chain_lock_validating_quorums + .into_iter() + .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) + .collect(), full_masternode_list: value .full_masternode_list .into_iter() @@ -209,6 +227,7 @@ impl PlatformStateV0 { current_validator_set_quorum_hash: QuorumHash::all_zeros(), next_validator_set_quorum_hash: None, validator_sets: Default::default(), + chain_lock_validating_quorums: Default::default(), full_masternode_list: Default::default(), hpmn_masternode_list: Default::default(), genesis_block_info: None, @@ -264,6 +283,9 @@ pub trait PlatformStateV0Methods { /// Returns the current validator sets. fn validator_sets(&self) -> &IndexMap; + /// Returns the current 400 60 quorums used to validate chain locks. + fn chain_lock_validating_quorums(&self) -> &BTreeMap; + /// Returns the full list of masternodes. fn full_masternode_list(&self) -> &BTreeMap; @@ -294,6 +316,9 @@ pub trait PlatformStateV0Methods { /// Sets the current validator sets. fn set_validator_sets(&mut self, sets: IndexMap); + /// Sets the current chain lock validating quorums. + fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap); + /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap); @@ -320,6 +345,9 @@ pub trait PlatformStateV0Methods { /// Returns a mutable reference to the current validator sets. fn validator_sets_mut(&mut self) -> &mut IndexMap; + /// Returns a mutable reference to the current chain lock validating quorums. + fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap; + /// Returns a mutable reference to the full masternode list. fn full_masternode_list_mut(&mut self) -> &mut BTreeMap; @@ -488,6 +516,11 @@ impl PlatformStateV0Methods for PlatformStateV0 { &self.validator_sets } + /// Returns the current 400 60 quorums used to validate chain locks. + fn chain_lock_validating_quorums(&self) -> &BTreeMap { + &self.chain_lock_validating_quorums + } + /// Returns the full list of masternodes. fn full_masternode_list(&self) -> &BTreeMap { &self.full_masternode_list @@ -538,6 +571,11 @@ impl PlatformStateV0Methods for PlatformStateV0 { self.validator_sets = sets; } + /// Sets the current chain lock validating quorums. + fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) { + self.chain_lock_validating_quorums = quorums; + } + /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap) { self.full_masternode_list = list; @@ -577,6 +615,10 @@ impl PlatformStateV0Methods for PlatformStateV0 { &mut self.validator_sets } + fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap { + &mut self.chain_lock_validating_quorums + } + fn full_masternode_list_mut(&mut self) -> &mut BTreeMap { &mut self.full_masternode_list } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs index ab9cb627f2d..827db4d0087 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs @@ -22,7 +22,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetDataContractRequestV0 { id, prove } = request; let contract_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs index fad0100be91..e9dfe8e7aa8 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs @@ -25,7 +25,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetDataContractHistoryRequestV0 { id, limit, diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs index b5f3e7f78ef..882c9e4dd78 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs @@ -23,7 +23,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetDataContractsRequestV0 { ids, prove } = request; let contract_ids = check_validation_result_with_data!(ids .into_iter() diff --git a/packages/rs-drive-abci/src/query/document_query/v0/mod.rs b/packages/rs-drive-abci/src/query/document_query/v0/mod.rs index 02c7747a248..c0a07f5a679 100644 --- a/packages/rs-drive-abci/src/query/document_query/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/document_query/v0/mod.rs @@ -28,7 +28,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetDocumentsRequestV0 { data_contract_id, document_type: document_type_name, diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs index 8865f6c46a8..8e956b6f5ad 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs @@ -21,7 +21,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentityRequestV0 { id, prove } = get_identity_request; let identity_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs index 20b851ed4d6..79b842a90ca 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs @@ -25,7 +25,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentityRequestV0 { id, prove } = get_identity_request; let identity_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs index d585053f717..e05f2e4ed10 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs @@ -22,7 +22,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentitiesRequestV0 { ids, prove } = get_identities_request; let identity_ids = check_validation_result_with_data!(ids .into_iter() diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs index 7235e4adbe6..7fbacdc79d8 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs @@ -26,7 +26,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentitiesByPublicKeyHashesRequestV0 { public_key_hashes, prove, diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs index 358ebd142bc..a4f849133f3 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs @@ -22,7 +22,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentityRequestV0 { id, prove } = get_identity_request; let identity_id: Identifier = check_validation_result_with_data!(id.try_into().map_err(|_| { diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs index 988a3e5d855..7bc82a33980 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs @@ -24,7 +24,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentityByPublicKeyHashRequestV0 { public_key_hash, prove, diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs index 80b3bbb6088..3f5b7a895e7 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs @@ -79,7 +79,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetIdentityKeysRequestV0 { identity_id, request_type, diff --git a/packages/rs-drive-abci/src/query/proofs/v0/mod.rs b/packages/rs-drive-abci/src/query/proofs/v0/mod.rs index 7969042161f..480b6286f59 100644 --- a/packages/rs-drive-abci/src/query/proofs/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/proofs/v0/mod.rs @@ -24,7 +24,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetProofsRequestV0 { identities, contracts, diff --git a/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs b/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs index 8fb355e59aa..38d5b0ced97 100644 --- a/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs @@ -25,7 +25,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetEpochsInfoRequestV0 { start_epoch, count, diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs index efba1e9fe7b..3bb9372d69a 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs @@ -24,7 +24,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetProtocolVersionUpgradeStateRequestV0 { prove } = request; let response_data = if prove { diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs index 02eb9debfb1..8201cf3264c 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs @@ -26,7 +26,7 @@ impl Platform { platform_version: &PlatformVersion, ) -> Result>, Error> { let metadata = self.response_metadata_v0(state); - let quorum_type = self.config.quorum_type() as u32; + let quorum_type = self.config.validator_set_quorum_type() as u32; let GetProtocolVersionUpgradeVoteStatusRequestV0 { start_pro_tx_hash, count, diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index e4564f46299..c5c1c21b0e4 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -820,7 +820,7 @@ pub(crate) fn continue_chain_for_strategy( query_strategy.query_chain_for_strategy( &ProofVerification { quorum_hash: ¤t_quorum_with_test_info.quorum_hash.into(), - quorum_type: config.quorum_type(), + quorum_type: config.validator_set_quorum_type(), app_version, chain_id: drive_abci::mimic::CHAIN_ID.to_string(), core_chain_locked_height: state_id.core_chain_locked_height, From a15b211068cb7bc23797477eb384da57666e0b9f Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 4 Dec 2023 04:16:15 +0700 Subject: [PATCH 02/51] added verification of chain lock structure --- .../rs-drive-abci/src/abci/handler/mod.rs | 5 --- packages/rs-drive-abci/src/config.rs | 1 + .../engine/run_block_proposal/v0/mod.rs | 6 +++ .../platform_events/core_chain_lock/mod.rs | 3 +- .../core_chain_lock/verify_chain_lock/mod.rs | 35 ++++++++++++++++++ .../verify_chain_lock/v0/mod.rs | 23 ++++++++++++ .../verify_chain_lock_locally/mod.rs | 37 ++++++++++++++++++- .../verify_chain_lock_locally/v0/mod.rs | 22 +++++++++++ .../verify_chain_lock_through_core/mod.rs | 36 +++++++++++++++++- .../verify_chain_lock_through_core/v0/mod.rs | 21 +++++++++++ .../src/execution/platform_events/mod.rs | 3 ++ .../src/platform_types/block_proposal/v0.rs | 31 +++++++++++++++- .../src/platform_types/platform_state/mod.rs | 4 +- .../src/version/drive_abci_versions.rs | 8 ++++ .../src/version/mocks/v2_test.rs | 23 +++--------- .../src/version/mocks/v3_test.rs | 23 +++--------- .../rs-platform-version/src/version/v1.rs | 23 +++--------- 17 files changed, 242 insertions(+), 62 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 65f5a48c08d..e959bb5ab4c 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -416,11 +416,6 @@ where }; let transaction = transaction_guard.as_ref().unwrap(); - // We can take the core chain lock update here because it won't be used anywhere else - if let Some(_c) = request.core_chain_lock_update.take() { - //todo: if there is a core chain lock update we need to validate it - } - // Running the proposal executes all the state transitions for the block let run_result = self .platform diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 667aa1b7489..c1fceaa3965 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -308,6 +308,7 @@ impl Default for PlatformConfig { fn default() -> Self { Self { validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), quorum_size: 100, block_spacing_ms: 5000, drive: Default::default(), diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 25156a27993..db3953b1275 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -110,6 +110,7 @@ where // destructure the block proposal let block_proposal::v0::BlockProposal { core_chain_locked_height, + core_chain_lock_update, proposed_app_version, proposer_pro_tx_hash, validator_set_quorum_hash, @@ -122,6 +123,11 @@ where .expect("current epoch index should be in range"), ); + // If there is a core chain lock update, we should start by verifying it + if let Some(core_chain_lock_update) = core_chain_lock_update { + //todo: verify the core chain lock update + } + // Update the masternode list and create masternode identities and also update the active quorums self.update_core_info( Some(&state), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index c8aa2724817..6e2b73a5b7e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -1,2 +1,3 @@ mod verify_chain_lock_locally; -mod verify_chain_lock_through_core; \ No newline at end of file +mod verify_chain_lock_through_core; +mod verify_chain_lock; \ No newline at end of file diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index e69de29bb2d..5475048e4d7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -0,0 +1,35 @@ +mod v0; + +use dpp::dashcore::ChainLock; +use crate::error::execution::ExecutionError; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +impl Platform + where + C: CoreRPCLike, +{ + /// Verify the chain lock + pub fn verify_chain_lock(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock + { + 0 => { + self.verify_chain_lock_v0(chain_lock, platform_version) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index e69de29bb2d..7efa1fca806 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -0,0 +1,23 @@ + +use dpp::dashcore::ChainLock; +use dpp::version::PlatformVersion; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +impl Platform + where + C: CoreRPCLike, +{ + pub(super) fn verify_chain_lock_v0(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + // first we verify the chain lock locally + if let Some(valid) = self.verify_chain_lock_locally(chain_lock, platform_version)? { + Ok(valid) + } else { + // if we were not able to validate it locally then we should go to core + self.verify_chain_lock_through_core(chain_lock, platform_version) + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs index 7affabc980c..9ef2fd50133 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -1 +1,36 @@ -mod v0; \ No newline at end of file +mod v0; + +use dpp::dashcore::ChainLock; +use crate::error::execution::ExecutionError; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +impl Platform + where + C: CoreRPCLike, +{ + /// Returning None here means we were unable to verify the chain lock because of an absence of + /// the quorum + pub fn verify_chain_lock_locally(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock_locally + { + 0 => { + self.verify_chain_lock_locally_v0(chain_lock, platform_version) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock_locally".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index e69de29bb2d..5c8afbd73d9 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -0,0 +1,22 @@ + +use dpp::dashcore::ChainLock; +use crate::error::execution::ExecutionError; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +impl Platform + where + C: CoreRPCLike, +{ + /// Returning None here means we were unable to verify the chain lock because of an absence of + /// the quorum + pub fn verify_chain_lock_locally_v0(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { + //todo() + return Ok(Some(true)) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs index 7affabc980c..f5b4dcfd640 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -1 +1,35 @@ -mod v0; \ No newline at end of file +mod v0; + +use dpp::dashcore::ChainLock; +use crate::error::execution::ExecutionError; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +impl Platform + where + C: CoreRPCLike, +{ + /// Verify the chain lock through core + pub fn verify_chain_lock_through_core(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + match platform_version + .drive_abci + .methods + .core_chain_lock + .verify_chain_lock_through_core + { + 0 => { + self.verify_chain_lock_through_core_v0(chain_lock) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "verify_chain_lock_through_core".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs index e69de29bb2d..342f0e099b7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -0,0 +1,21 @@ +use dpp::dashcore::ChainLock; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +impl Platform + where + C: CoreRPCLike, +{ + /// Verify the chain lock through core v0 + pub fn verify_chain_lock_through_core_v0(&self, chain_lock: &ChainLock) -> Result { + + // Should we have a max height here? + + let valid = self.core_rpc.verify_chain_lock(chain_lock, None)?; + + Ok(valid) + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/mod.rs index 51efcb08668..7e79189addd 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/mod.rs @@ -25,3 +25,6 @@ pub(in crate::execution) mod withdrawals; /// Events happening what starting to process a block pub(in crate::execution) mod block_start; + +/// Verify the chain lock +pub(in crate::execution) mod core_chain_lock; diff --git a/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs b/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs index 31486f97e05..652c4fee143 100644 --- a/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs +++ b/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs @@ -3,7 +3,12 @@ use crate::error::Error; use std::fmt; use tenderdash_abci::proto::abci::{RequestPrepareProposal, RequestProcessProposal}; use tenderdash_abci::proto::serializers::timestamp::ToMilis; +use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::proto::version::Consensus; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::dashcore::{BlockHash, ChainLock}; +use dpp::dashcore::hashes::Hash; +use dpp::platform_value::Bytes32; /// The block proposal is the combination of information that a proposer will propose, /// Or that a validator or full node will process @@ -20,6 +25,8 @@ pub struct BlockProposal<'a> { pub block_time_ms: u64, /// Block height of the core chain pub core_chain_locked_height: u32, + /// Potential update core chain lock + pub core_chain_lock_update: Option, /// The proposed app version pub proposed_app_version: u64, /// Block proposer's proTxHash @@ -133,6 +140,7 @@ impl<'a> TryFrom<&'a RequestPrepareProposal> for BlockProposal<'a> { height: *height as u64, round: *round as u32, core_chain_locked_height: *core_chain_locked_height, + core_chain_lock_update: None, //there is no need to verify a chain lock we are proposing proposed_app_version: *proposed_app_version, proposer_pro_tx_hash, validator_set_quorum_hash, @@ -157,7 +165,7 @@ impl<'a> TryFrom<&'a RequestProcessProposal> for BlockProposal<'a> { time, next_validators_hash: _, core_chain_locked_height, - core_chain_lock_update: _, + core_chain_lock_update, proposer_pro_tx_hash, proposed_app_version, version, @@ -207,12 +215,33 @@ impl<'a> TryFrom<&'a RequestProcessProposal> for BlockProposal<'a> { ) .into()); } + + let core_chain_lock_update = core_chain_lock_update.as_ref().map(|core_chain_lock| { + let CoreChainLock { + core_block_height, core_block_hash, signature + } = core_chain_lock; + + let block_hash : Bytes32 = Bytes32::from_vec(core_block_hash.clone())?; + + let signature : [u8;96] = signature.clone().try_into().map_err(|_| { + AbciError::BadRequest( + "core chain lock signature not 96 bytes".to_string(), + ) + })?; + + Ok::(ChainLock { + block_height: *core_block_height, + block_hash: BlockHash::from_byte_array(block_hash.0), + signature: BLSSignature::from(signature), + }) + }).transpose()?; Ok(Self { consensus_versions, block_hash: Some(block_hash), height: *height as u64, round: *round as u32, core_chain_locked_height: *core_chain_locked_height, + core_chain_lock_update, proposed_app_version: *proposed_app_version, proposer_pro_tx_hash, validator_set_quorum_hash, diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index a416e77e8a7..a9bc27646bc 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -331,7 +331,7 @@ impl PlatformStateV0Methods for PlatformState { } } - fn chain_lock_validating_quorums(&self) -> &IndexMap { + fn chain_lock_validating_quorums(&self) -> &BTreeMap { match self { PlatformState::V0(v0) => &v0.chain_lock_validating_quorums, } @@ -397,7 +397,7 @@ impl PlatformStateV0Methods for PlatformState { } } - fn set_chain_lock_validating_quorums(&mut self, quorums: IndexMap) { + fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) { match self { PlatformState::V0(v0) => v0.set_chain_lock_validating_quorums(quorums), } diff --git a/packages/rs-platform-version/src/version/drive_abci_versions.rs b/packages/rs-platform-version/src/version/drive_abci_versions.rs index a3e9d9a4420..df2b737d5ee 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions.rs @@ -61,6 +61,7 @@ pub struct DriveAbciMethodVersions { pub protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions, pub block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions, pub core_subsidy: DriveAbciCoreSubsidyMethodVersions, + pub core_chain_lock: DriveAbciCoreChainLockMethodVersions, pub fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions, pub fee_pool_outwards_distribution: DriveAbciFeePoolOutwardsDistributionMethodVersions, pub identity_credit_withdrawal: DriveAbciIdentityCreditWithdrawalMethodVersions, @@ -195,6 +196,13 @@ pub struct DriveAbciCoreSubsidyMethodVersions { pub epoch_core_reward_credits_for_distribution: FeatureVersion, } +#[derive(Clone, Debug, Default)] +pub struct DriveAbciCoreChainLockMethodVersions { + pub verify_chain_lock: FeatureVersion, + pub verify_chain_lock_locally: FeatureVersion, + pub verify_chain_lock_through_core: FeatureVersion, +} + #[derive(Clone, Debug, Default)] pub struct DriveAbciFeePoolInwardsDistributionMethodVersions { pub add_distribute_block_fees_into_pools_operations: FeatureVersion, diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 481b2b0a6a3..f5b7f3a96ae 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -9,23 +9,7 @@ use crate::version::dpp_versions::{ RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, }; -use crate::version::drive_abci_versions::{ - DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, - DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreSubsidyMethodVersions, - DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, - DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, - DriveAbciFeePoolOutwardsDistributionMethodVersions, - DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, - DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, - DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, - DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, - DriveAbciStateTransitionCommonValidationVersions, - DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, - DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, - DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, - DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, -}; +use crate::version::drive_abci_versions::{DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions}; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, DriveContractApplyMethodVersions, DriveContractCostsMethodVersions, @@ -498,6 +482,11 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { core_subsidy: DriveAbciCoreSubsidyMethodVersions { epoch_core_reward_credits_for_distribution: 0, }, + core_chain_lock: DriveAbciCoreChainLockMethodVersions { + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, add_distribute_storage_fee_to_epochs_operations: 0, diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 846fbf9b013..0e5c703140a 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -9,23 +9,7 @@ use crate::version::dpp_versions::{ RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, }; -use crate::version::drive_abci_versions::{ - DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, - DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreSubsidyMethodVersions, - DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, - DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, - DriveAbciFeePoolOutwardsDistributionMethodVersions, - DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, - DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, - DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, - DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, - DriveAbciStateTransitionCommonValidationVersions, - DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, - DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, - DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, - DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, -}; +use crate::version::drive_abci_versions::{DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions}; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, DriveContractApplyMethodVersions, DriveContractCostsMethodVersions, @@ -498,6 +482,11 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { core_subsidy: DriveAbciCoreSubsidyMethodVersions { epoch_core_reward_credits_for_distribution: 0, }, + core_chain_lock: DriveAbciCoreChainLockMethodVersions { + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, add_distribute_storage_fee_to_epochs_operations: 0, diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index f53927ca66f..4bcd6fea505 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -9,23 +9,7 @@ use crate::version::dpp_versions::{ RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, }; -use crate::version::drive_abci_versions::{ - DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, - DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreSubsidyMethodVersions, - DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, - DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, - DriveAbciFeePoolOutwardsDistributionMethodVersions, - DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, - DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, - DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, - DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, - DriveAbciStateTransitionCommonValidationVersions, - DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, - DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, - DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, - DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, -}; +use crate::version::drive_abci_versions::{DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions}; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, DriveContractApplyMethodVersions, DriveContractCostsMethodVersions, @@ -495,6 +479,11 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { core_subsidy: DriveAbciCoreSubsidyMethodVersions { epoch_core_reward_credits_for_distribution: 0, }, + core_chain_lock: DriveAbciCoreChainLockMethodVersions { + verify_chain_lock: 0, + verify_chain_lock_locally: 0, + verify_chain_lock_through_core: 0, + }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, add_distribute_storage_fee_to_epochs_operations: 0, From f32b2a313064590657eed72b71a6740e5a6c5d4d Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 4 Dec 2023 22:27:55 +0700 Subject: [PATCH 03/51] more work --- packages/rs-drive-abci/src/abci/error.rs | 4 ++ .../engine/run_block_proposal/v0/mod.rs | 10 ++++- .../update_quorum_info/v0/mod.rs | 2 + .../core_chain_lock/verify_chain_lock/mod.rs | 5 ++- .../verify_chain_lock/v0/mod.rs | 24 ++++++++--- .../verify_chain_lock_locally/mod.rs | 5 ++- .../verify_chain_lock_locally/v0/mod.rs | 40 +++++++++++++++++-- .../platform_types/platform_state/v0/mod.rs | 23 +++++++++++ 8 files changed, 98 insertions(+), 15 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/error.rs b/packages/rs-drive-abci/src/abci/error.rs index ce2016900ca..54ffb5f7ba6 100644 --- a/packages/rs-drive-abci/src/abci/error.rs +++ b/packages/rs-drive-abci/src/abci/error.rs @@ -45,6 +45,10 @@ pub enum AbciError { #[error("bad commit signature: {0}")] BadCommitSignature(String), + /// The chain lock received was invalid + #[error("invalid chain lock: {0}")] + InvalidChainLock(String), + /// Error returned by Tenderdash-abci library #[error("tenderdash: {0}")] Tenderdash(#[from] tenderdash_abci::Error), diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index db3953b1275..d22dcc0785f 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -124,8 +124,14 @@ where ); // If there is a core chain lock update, we should start by verifying it - if let Some(core_chain_lock_update) = core_chain_lock_update { - //todo: verify the core chain lock update + if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { + let valid = self.verify_chain_lock(&block_platform_state, core_chain_lock_update, platform_version)?; + if !valid { + return Ok(ValidationResult::new_with_error(AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid {:?}", + block_info.height, core_chain_lock_update, + )).into())) + } } // Update the masternode list and create masternode identities and also update the active quorums diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index fe9c7a43970..8c47e3aba55 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -50,6 +50,8 @@ where return Ok(()); // no need to do anything } + // We should request the quorum list from 8 blocks behind the core block height + let mut extended_quorum_list = self .core_rpc .get_quorum_listextended(Some(core_block_height))?; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index 5475048e4d7..11a4f20c901 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -9,13 +9,14 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; +use crate::platform_types::platform_state::PlatformState; impl Platform where C: CoreRPCLike, { /// Verify the chain lock - pub fn verify_chain_lock(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + pub fn verify_chain_lock(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { match platform_version .drive_abci .methods @@ -23,7 +24,7 @@ impl Platform .verify_chain_lock { 0 => { - self.verify_chain_lock_v0(chain_lock, platform_version) + self.verify_chain_lock_v0( platform_state, chain_lock, platform_version) } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock".to_string(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index 7efa1fca806..0f33f08fcc1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -4,6 +4,8 @@ use dpp::version::PlatformVersion; use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::rpc::core::CoreRPCLike; @@ -11,12 +13,24 @@ impl Platform where C: CoreRPCLike, { - pub(super) fn verify_chain_lock_v0(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { - // first we verify the chain lock locally - if let Some(valid) = self.verify_chain_lock_locally(chain_lock, platform_version)? { - Ok(valid) + pub(super) fn verify_chain_lock_v0(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + // we attempt to verify the chain lock locally + // if the chain lock height is within the interval in which the quorums should not have changed + let current_height = platform_state.core_height(); + + //todo: is this correct? Also maybe this should be a parameter + + let end_window = current_height % 24 + 23; + + if chain_lock.block_height <= end_window { + // first we verify the chain lock locally + if let Some(valid) = self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? { + Ok(valid) + } else { + // if we were not able to validate it locally then we should go to core + self.verify_chain_lock_through_core(chain_lock, platform_version) + } } else { - // if we were not able to validate it locally then we should go to core self.verify_chain_lock_through_core(chain_lock, platform_version) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs index 9ef2fd50133..12878af2a42 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -9,6 +9,7 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; +use crate::platform_types::platform_state::PlatformState; impl Platform where @@ -16,7 +17,7 @@ impl Platform { /// Returning None here means we were unable to verify the chain lock because of an absence of /// the quorum - pub fn verify_chain_lock_locally(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { + pub fn verify_chain_lock_locally(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { match platform_version .drive_abci .methods @@ -24,7 +25,7 @@ impl Platform .verify_chain_lock_locally { 0 => { - self.verify_chain_lock_locally_v0(chain_lock, platform_version) + self.verify_chain_lock_locally_v0(platform_state, chain_lock, platform_version) } version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock_locally".to_string(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 5c8afbd73d9..930a78dfdb7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -1,6 +1,8 @@ -use dpp::dashcore::ChainLock; -use crate::error::execution::ExecutionError; +use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; +use dpp::dashcore::consensus::Encodable; +use dpp::dashcore::hashes::{Hash, HashEngine, sha256}; +use dpp::dashcore::signer::double_sha; use crate::error::Error; use crate::platform_types::platform::Platform; @@ -8,6 +10,10 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; +use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; + +const CHAIN_LOCK_REQUEST_ID_PREFIX: &str = "clsig"; impl Platform where @@ -15,8 +21,34 @@ impl Platform { /// Returning None here means we were unable to verify the chain lock because of an absence of /// the quorum - pub fn verify_chain_lock_locally_v0(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { + pub fn verify_chain_lock_locally_v0(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { + let quorums = platform_state.chain_lock_validating_quorums(); + + // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks + // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. + + let mut engine = QuorumSigningRequestId::engine(); + + // Prefix + let prefix_len = VarInt(CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u64); + prefix_len.consensus_encode(&mut engine).expect("expected to encode the prefix"); + + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(chain_lock.block_height.to_be_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined + + //todo don't choose first, but choose the correct one + + if let Some((quorum_hash, public_key)) = platform_state.chain_lock_validating_quorums().first_key_value() { + + } + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + //todo() - return Ok(Some(true)) + return Ok(None) } } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index 9ebff07682e..e12825dbe74 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -21,6 +21,7 @@ use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; use std::collections::BTreeMap; use std::fmt::{Debug, Formatter}; use dpp::bls_signatures::{PublicKey as ThresholdBlsPublicKey}; +use drive::grovedb::batch::Op; /// Platform state #[derive(Clone)] @@ -45,6 +46,11 @@ pub struct PlatformStateV0 { /// The current 400 60 quorums used for validating chain locks pub chain_lock_validating_quorums: BTreeMap, + /// The slightly old 400 60 quorums used for validating chain locks, it's important to keep + /// these because validation of signatures happens for the quorums that are 8 blocks before the + /// height written in the chain lock + pub previous_height_chain_lock_validating_quorums: Option<(u32, BTreeMap)>, + /// current full masternode list pub full_masternode_list: BTreeMap, @@ -119,6 +125,10 @@ pub(super) struct PlatformStateForSavingV0 { #[bincode(with_serde)] pub chain_lock_validating_quorums: Vec<(Bytes32, ThresholdBlsPublicKey)>, + /// The 400 60 quorums used for validating chain locks from a slightly previous height. + #[bincode(with_serde)] + pub previous_height_chain_lock_validating_quorums: Option<(u32, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, + /// current full masternode list pub full_masternode_list: BTreeMap, @@ -153,6 +163,12 @@ impl TryFrom for PlatformStateForSavingV0 { .into_iter() .map(|(k, v)| (k.to_byte_array().into(), v)) .collect(), + previous_height_chain_lock_validating_quorums: value + .previous_height_chain_lock_validating_quorums.map(|(previous_height, inner_value)| { + (previous_height, inner_value.into_iter() + .map(|(k, v)| (k.to_byte_array().into(), v)) + .collect()) + }), full_masternode_list: value .full_masternode_list .into_iter() @@ -200,6 +216,12 @@ impl From for PlatformStateV0 { .into_iter() .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) .collect(), + previous_height_chain_lock_validating_quorums: value.previous_height_chain_lock_validating_quorums.map(|(previous_height, inner_value)| { + (previous_height, inner_value.into_iter() + .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) + .collect()) + }) + , full_masternode_list: value .full_masternode_list .into_iter() @@ -228,6 +250,7 @@ impl PlatformStateV0 { next_validator_set_quorum_hash: None, validator_sets: Default::default(), chain_lock_validating_quorums: Default::default(), + previous_height_chain_lock_validating_quorums: None, full_masternode_list: Default::default(), hpmn_masternode_list: Default::default(), genesis_block_info: None, From 2b246990adb3554ede4e68bfedc22d3613923925 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 6 Dec 2023 22:44:51 +0700 Subject: [PATCH 04/51] more work on validating chain locks --- .../rs-drive-abci/src/abci/handler/mod.rs | 12 +-- packages/rs-drive-abci/src/error/mod.rs | 4 + .../engine/run_block_proposal/v0/mod.rs | 6 +- .../update_core_info/v0/mod.rs | 7 ++ .../update_state_masternode_list/v0/mod.rs | 2 +- .../update_masternode_list/v0/mod.rs | 6 +- .../update_quorum_info/mod.rs | 2 + .../update_quorum_info/v0/mod.rs | 100 +++++++++++++++--- .../core_chain_lock/choose_quorum/mod.rs | 40 +++++++ .../core_chain_lock/choose_quorum/v0/mod.rs | 48 +++++++++ .../platform_events/core_chain_lock/mod.rs | 3 +- .../verify_chain_lock/v0/mod.rs | 19 +--- .../verify_chain_lock_locally/v0/mod.rs | 57 ++++++++-- .../epoch/gather_epoch_info/v0/mod.rs | 2 +- .../state_transition/processor/v0/mod.rs | 2 +- .../structure_v0/mod.rs | 2 +- .../structure_v0/mod.rs | 2 +- .../data_triggers/triggers/dashpay/v0/mod.rs | 2 +- .../triggers/feature_flags/v0/mod.rs | 2 +- .../state/v0/fetch_documents.rs | 2 +- .../state/v0/mod.rs | 2 +- .../identity_update/state/v0/mod.rs | 2 +- .../src/platform_types/platform_state/mod.rs | 76 ++++++++----- .../platform_types/platform_state/v0/mod.rs | 82 +++++++++----- .../data_contract/v0/mod.rs | 8 +- .../data_contract_history/v0/mod.rs | 8 +- .../data_contracts/v0/mod.rs | 8 +- .../src/query/document_query/v0/mod.rs | 8 +- .../identity_based_queries/balance/v0/mod.rs | 8 +- .../balance_and_revision/v0/mod.rs | 8 +- .../identities/v0/mod.rs | 8 +- .../identities_by_public_key_hashes/v0/mod.rs | 8 +- .../identity_based_queries/identity/v0/mod.rs | 8 +- .../identity_by_public_key_hash/v0/mod.rs | 8 +- .../identity_based_queries/keys/v0/mod.rs | 8 +- .../rs-drive-abci/src/query/proofs/v0/mod.rs | 8 +- .../src/query/response_metadata/v0/mod.rs | 8 +- .../src/query/system/epoch_infos/v0/mod.rs | 10 +- .../system/version_upgrade_state/v0/mod.rs | 8 +- .../version_upgrade_vote_status/v0/mod.rs | 8 +- .../tests/strategy_tests/query.rs | 2 +- .../src/version/drive_abci_versions.rs | 1 + .../src/version/mocks/v2_test.rs | 1 + .../src/version/mocks/v3_test.rs | 1 + .../rs-platform-version/src/version/v1.rs | 1 + 45 files changed, 438 insertions(+), 180 deletions(-) create mode 100644 packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs create mode 100644 packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index e959bb5ab4c..62786daca17 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -94,7 +94,7 @@ where } let state_app_hash = state_guard - .last_block_app_hash() + .last_committed_block_app_hash() .map(|app_hash| app_hash.to_vec()) .unwrap_or_default(); @@ -103,7 +103,7 @@ where let response = proto::ResponseInfo { data: "".to_string(), app_version: latest_platform_version.protocol_version as u64, - last_block_height: state_guard.last_block_height() as i64, + last_block_height: state_guard.last_committed_block_height() as i64, version: env!("CARGO_PKG_VERSION").to_string(), last_block_app_hash: state_app_hash.clone(), }; @@ -114,9 +114,9 @@ where block_version = request.block_version, p2p_version = request.p2p_version, app_hash = hex::encode(state_app_hash), - height = state_guard.last_block_height(), + height = state_guard.last_committed_block_height(), "Consensus engine is started from block {}", - state_guard.last_block_height(), + state_guard.last_committed_block_height(), ); if tracing::enabled!(tracing::Level::TRACE) { @@ -737,7 +737,7 @@ where key: vec![], value: vec![], proof_ops: None, - height: self.platform.state.read().unwrap().height() as i64, + height: self.platform.state.read().unwrap().last_committed_height() as i64, codespace: "".to_string(), }; @@ -773,7 +773,7 @@ where key: vec![], value: data, proof_ops: None, - height: self.platform.state.read().unwrap().height() as i64, + height: self.platform.state.read().unwrap().last_committed_height() as i64, codespace: "".to_string(), }; diff --git a/packages/rs-drive-abci/src/error/mod.rs b/packages/rs-drive-abci/src/error/mod.rs index 3658a8169dc..89796a1c7c8 100644 --- a/packages/rs-drive-abci/src/error/mod.rs +++ b/packages/rs-drive-abci/src/error/mod.rs @@ -9,6 +9,7 @@ use drive::dpp::ProtocolError; use drive::error::Error as DriveError; use tenderdash_abci::proto::abci::ResponseException; use tracing::error; +use dpp::bls_signatures::BlsError; /// Execution errors module pub mod execution; @@ -36,6 +37,9 @@ pub enum Error { /// Core RPC Error #[error("core rpc error: {0}")] CoreRpc(#[from] CoreRpcError), + /// BLS Error + #[error("BLS error: {0}")] + BLSError(#[from] BlsError), /// Serialization Error #[error("serialization: {0}")] Serialization(#[from] SerializationError), diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index d22dcc0785f..5651148e1a3 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -80,11 +80,11 @@ where block_proposal.round, ); - let last_block_time_ms = state.last_block_time_ms(); + let last_block_time_ms = state.last_committed_block_time_ms(); let last_block_height = - state.known_height_or(self.config.abci.genesis_height.saturating_sub(1)); + state.last_committed_known_height_or(self.config.abci.genesis_height.saturating_sub(1)); let last_block_core_height = - state.known_core_height_or(self.config.abci.genesis_core_height); + state.last_committed_known_core_height_or(self.config.abci.genesis_core_height); let hpmn_list_len = state.hpmn_list_len(); let mut block_platform_state = state.clone(); diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs index 467af1138b2..1273cce508a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs @@ -5,6 +5,7 @@ use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; impl Platform where @@ -40,6 +41,11 @@ where transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { + // the core height of the block platform state is the last committed + if !is_init_chain && block_platform_state.last_committed_core_height() == core_block_height { + // if we get the same height that we know we do not need to update core info + return Ok(()); + } self.update_masternode_list( platform_state, block_platform_state, @@ -51,6 +57,7 @@ where )?; self.update_quorum_info( + platform_state, block_platform_state, core_block_height, false, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs index fc0f4c3ea94..b6c447fa75b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/update_state_masternode_list/v0/mod.rs @@ -90,7 +90,7 @@ where // baseBlock must be a chain height and not 0 None } else { - let state_core_height = state.core_height(); + let state_core_height = state.last_committed_core_height(); if core_block_height == state_core_height { return Ok(update_state_masternode_list_outcome::v0::UpdateStateMasternodeListOutcome::default()); // no need to do anything diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs index e9372043b18..f60a9159944 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_list/v0/mod.rs @@ -40,10 +40,10 @@ where transaction: &Transaction, platform_version: &PlatformVersion, ) -> Result<(), Error> { - if let Some(last_commited_block_info) = + if let Some(last_committed_block_info) = block_platform_state.last_committed_block_info().as_ref() { - if core_block_height == last_commited_block_info.basic_info().core_height { + if core_block_height == last_committed_block_info.basic_info().core_height { tracing::debug!( method = "update_masternode_list_v0", "no update mnl at height {}", @@ -56,7 +56,7 @@ where method = "update_masternode_list_v0", "update mnl to height {} at block {}", core_block_height, - block_platform_state.core_height() + block_platform_state.last_committed_core_height() ); //todo: there's a weird condition that can happen if we are not on init chain, but we are // in the genesis and we are not on round 0, and the core height changed diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs index 535f5e5ff0c..87510c71171 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/mod.rs @@ -26,6 +26,7 @@ where /// on success, or an `Error` on failure. pub(in crate::execution::platform_events::core_based_updates) fn update_quorum_info( &self, + platform_state: Option<&PlatformState>, block_platform_state: &mut PlatformState, core_block_height: u32, start_from_scratch: bool, @@ -38,6 +39,7 @@ where .update_quorum_info { 0 => self.update_quorum_info_v0( + platform_state, block_platform_state, core_block_height, start_from_scratch, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 8c47e3aba55..a4913fa4451 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -11,6 +11,7 @@ use crate::rpc::core::CoreRPCLike; use dpp::dashcore::QuorumHash; use tracing::Level; +use dpp::bls_signatures::PublicKey as BlsPublicKey; impl Platform where @@ -29,6 +30,7 @@ where /// on success, or an `Error` on failure. pub(super) fn update_quorum_info_v0( &self, + platform_state: Option<&PlatformState>, block_platform_state: &mut PlatformState, core_block_height: u32, start_from_scratch: bool, @@ -37,11 +39,11 @@ where if start_from_scratch { tracing::debug!("update quorum info from scratch up to {core_block_height}"); - } else if core_block_height != block_platform_state.core_height() { + } else if core_block_height != block_platform_state.last_committed_core_height() { tracing::debug!( - previous_core_block_height = block_platform_state.core_height(), + previous_core_block_height = block_platform_state.last_committed_core_height(), "update quorum info from {} to {}", - block_platform_state.core_height(), + block_platform_state.last_committed_core_height(), core_block_height ); } else { @@ -71,12 +73,15 @@ where .into_iter() .collect(); + let mut removed_a_validator_set = false; + // Remove validator_sets entries that are no longer valid for the core block height block_platform_state .validator_sets_mut() .retain(|quorum_hash, _| { - let has_quorum = validator_quorums_list.contains_key::(quorum_hash); - has_quorum + let retain = validator_quorums_list.contains_key::(quorum_hash); + removed_a_validator_set |= !retain; + retain }); // Fetch quorum info and their keys from the RPC for new quorums @@ -128,6 +133,8 @@ where }) .collect::, Error>>()?; + let added_a_validator_set = !new_validator_sets.is_empty(); + // Add new validator_sets entries block_platform_state .validator_sets_mut() @@ -150,12 +157,14 @@ where if validator_set_quorum_type == chain_lock_quorum_type { // Remove validator_sets entries that are no longer valid for the core block height - block_platform_state - .chain_lock_validating_quorums_mut() - .retain(|quorum_hash, _| { - let has_quorum = validator_quorums_list.contains_key::(quorum_hash); - has_quorum - }); + if removed_a_validator_set || added_a_validator_set { + let chain_lock_validating_quorums = block_platform_state.validator_sets().iter().map(|(quorum_hash, validator_set)| { + (quorum_hash.clone(), validator_set.threshold_public_key().clone()) + }).collect(); + let previous_quorums = block_platform_state + .replace_chain_lock_validating_quorums(chain_lock_validating_quorums); + block_platform_state.set_previous_chain_lock_validating_quorums(block_platform_state.last_committed_core_height(), previous_quorums); + } } else { let chain_lock_quorums_list: BTreeMap<_, _> = extended_quorum_list .quorums_by_type @@ -166,15 +175,78 @@ where self.config.chain_lock_quorum_type ), )))? - .into_iter() + .into_iter().map(|(quorum_hash, extended_quorum_details)| { + (quorum_hash, extended_quorum_details.quorum_index) + }) .collect(); + let mut removed_a_chain_lock_validating_quorum = false; + + // Remove chain_lock_validating_quorums entries that are no longer valid for the core block height block_platform_state .chain_lock_validating_quorums_mut() .retain(|quorum_hash, _| { - let has_quorum = chain_lock_quorums_list.contains_key::(quorum_hash); - has_quorum + let retain = chain_lock_quorums_list.contains_key::(quorum_hash); + removed_a_chain_lock_validating_quorum |= !retain; + retain }); + + // Fetch quorum info and their keys from the RPC for new quorums + let quorum_infos = chain_lock_quorums_list + .iter() + .filter(|(key, _)| { + !block_platform_state + .chain_lock_validating_quorums() + .contains_key::(key) + }) + .map(|(key, _)| { + let quorum_info_result = + self.core_rpc + .get_quorum_info(chain_lock_quorum_type, key, None)?; + + Ok((*key, quorum_info_result)) + }) + .collect::, Error>>()?; + + let added_a_chain_lock_validating_quorum = !quorum_infos.is_empty(); + + if added_a_chain_lock_validating_quorum { + // Map to validator sets + let new_chain_lock_quorums = quorum_infos + .into_iter() + .map(|(quorum_hash, info_result)| { + let public_key = match BlsPublicKey::from_bytes(info_result.quorum_public_key.as_slice()) + .map_err(ExecutionError::BlsErrorFromDashCoreResponse) + { + Ok(public_key) => public_key, + Err(e) => return Err(e.into()), + }; + + tracing::trace!( + ?public_key, + ?quorum_hash, + quorum_type = ?chain_lock_quorum_type, + "add new chain lock quorum {} with quorum type {}", + quorum_hash, + chain_lock_quorum_type + ); + + Ok((quorum_hash, public_key)) + }) + .collect::, Error>>()?; + + // Add new validator_sets entries + block_platform_state + .chain_lock_validating_quorums_mut() + .extend(new_chain_lock_quorums); + } + + if added_a_chain_lock_validating_quorum || removed_a_chain_lock_validating_quorum { + if let Some(old_state) = platform_state { + let previous_chain_lock_validating_quorums = old_state.chain_lock_validating_quorums().clone(); + block_platform_state.set_previous_chain_lock_validating_quorums(block_platform_state.last_committed_core_height(), previous_chain_lock_validating_quorums); + } + } } Ok(()) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs new file mode 100644 index 00000000000..f2fdd129314 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -0,0 +1,40 @@ +mod v0; + +use std::collections::BTreeMap; +use dashcore_rpc::dashcore_rpc_json::QuorumType; +use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::{ChainLock, QuorumHash}; +use dpp::platform_value::Bytes32; +use crate::error::execution::ExecutionError; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +impl Platform + where + C: CoreRPCLike, +{ + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + /// + pub fn choose_quorum<'a>(&self, llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8;32], platform_version: &PlatformVersion) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .choose_quorum + { + 0 => { + Ok(self.choose_quorum_v0(llmq_quorum_type, quorums, request_id, platform_version)) + } + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "choose_quorum".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs new file mode 100644 index 00000000000..e0184364c9a --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -0,0 +1,48 @@ + + +use std::collections::BTreeMap; +use dashcore_rpc::dashcore_rpc_json::QuorumType; +use sha2::Sha256; +use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::{ChainLock, QuorumHash}; +use dpp::dashcore::hashes::{Hash, HashEngine, sha256d}; +use dpp::platform_value::Bytes32; +use crate::error::Error; + +use crate::platform_types::platform::Platform; + +use crate::rpc::core::CoreRPCLike; + +use dpp::version::PlatformVersion; + +impl Platform + where + C: CoreRPCLike, +{ + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + pub(super) fn choose_quorum_v0<'a>(&self, llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8;32], _platform_version: &PlatformVersion) -> Option<(&'a QuorumHash, &'a BlsPublicKey)> { + // Scoring system logic + let mut scores: Vec<(&QuorumHash, &BlsPublicKey, [u8;32])> = Vec::new(); + + for (quorum_hash, public_key) in quorums { + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[llmq_quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash.as_byte_array()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash, public_key, hash_result.into())); + } + + scores.sort_by_key(|k| k.2); + scores.first().map(|&(hash, key, _)| (hash, key)) + } + +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index 6e2b73a5b7e..76a70aaae80 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -1,3 +1,4 @@ mod verify_chain_lock_locally; mod verify_chain_lock_through_core; -mod verify_chain_lock; \ No newline at end of file +mod verify_chain_lock; +mod choose_quorum; \ No newline at end of file diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index 0f33f08fcc1..a8da73b63d9 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -14,23 +14,12 @@ impl Platform C: CoreRPCLike, { pub(super) fn verify_chain_lock_v0(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { - // we attempt to verify the chain lock locally - // if the chain lock height is within the interval in which the quorums should not have changed - let current_height = platform_state.core_height(); - //todo: is this correct? Also maybe this should be a parameter - - let end_window = current_height % 24 + 23; - - if chain_lock.block_height <= end_window { - // first we verify the chain lock locally - if let Some(valid) = self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? { - Ok(valid) - } else { - // if we were not able to validate it locally then we should go to core - self.verify_chain_lock_through_core(chain_lock, platform_version) - } + // first we try to verify the chain lock locally + if let Some(valid) = self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? { + Ok(valid) } else { + // if we were not able to validate it locally then we should go to core self.verify_chain_lock_through_core(chain_lock, platform_version) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 930a78dfdb7..278ac10232d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -1,8 +1,8 @@ - +use dpp::bls_signatures::G2Element; use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; use dpp::dashcore::consensus::Encodable; -use dpp::dashcore::hashes::{Hash, HashEngine, sha256}; -use dpp::dashcore::signer::double_sha; +use dpp::dashcore::hashes::{Hash, HashEngine, sha256d}; + use crate::error::Error; use crate::platform_types::platform::Platform; @@ -22,7 +22,34 @@ impl Platform /// Returning None here means we were unable to verify the chain lock because of an absence of /// the quorum pub fn verify_chain_lock_locally_v0(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { - let quorums = platform_state.chain_lock_validating_quorums(); + + // First verify that the signature conforms to a signature + let signature = G2Element::from_bytes(chain_lock.signature.as_bytes())?; + + // we attempt to verify the chain lock locally + let chain_lock_height = chain_lock.block_height; + + let window_width = 578; + + // The last block in the window where the quorums would be the same + let last_block_in_window = platform_state.last_committed_core_height() - platform_state.last_committed_core_height() % window_width + window_width - 1; + + let verification_height = chain_lock.block_height - 8; + + if verification_height > last_block_in_window { + return Ok(None); // the chain lock is too far in the future or the past to verify locally + } + + let quorums = if let Some((previous_quorum_height, previous_quorums)) = platform_state.previous_height_chain_lock_validating_quorums() { + if chain_lock_height > 8 && chain_lock_height - 8 <= *previous_quorum_height { + // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock + previous_quorums + } else { + platform_state.chain_lock_validating_quorums() + } + } else { + platform_state.chain_lock_validating_quorums() + }; // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. @@ -40,15 +67,25 @@ impl Platform // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined - //todo don't choose first, but choose the correct one + let quorum = self.choose_quorum(self.config.chain_lock_quorum_type(), quorums, request_id.as_ref(), platform_version)?; - if let Some((quorum_hash, public_key)) = platform_state.chain_lock_validating_quorums().first_key_value() { - - } + let Some((quorum_hash, public_key)) = quorum else { + return Ok(None); + }; // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. - //todo() - return Ok(None) + let mut engine = sha256d::Hash::engine(); + + engine.input(&[self.config.chain_lock_quorum_type() as u8]); + engine.input(quorum_hash.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + let chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + + return Ok(Some(chain_lock_verified)) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs index a64fb5ac28f..ea3dd74b655 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/epoch/gather_epoch_info/v0/mod.rs @@ -19,7 +19,7 @@ impl Platform { // Start by getting information from the state let state = self.state.read().unwrap(); - let last_block_time_ms = state.last_block_time_ms(); + let last_block_time_ms = state.last_committed_block_time_ms(); // Init block execution context let block_state_info = block_state_info::v0::BlockStateInfoV0::from_block_proposal( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs index 4f9f4f7d351..561c76e7d32 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/processor/v0/mod.rs @@ -95,7 +95,7 @@ pub(in crate::execution) fn process_state_transition_v0<'a, C: CoreRPCLike>( ExecutionEvent::create_from_state_transition_action( action, maybe_identity, - platform.state.epoch_ref(), + platform.state.last_committed_block_epoch_ref(), platform_version, ) }) diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs index 22409379a81..be05c9bd569 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_create_transition_action/structure_v0/mod.rs @@ -78,7 +78,7 @@ impl DocumentCreateTransitionActionStructureValidationV0 for DocumentCreateTrans // Validate timestamps against block time // we do validation here but not in validate state because it's a cheap validation // and validate state implements expensive validation only - let latest_block_time_ms = platform.state.last_block_time_ms(); + let latest_block_time_ms = platform.state.last_committed_block_time_ms(); let average_block_spacing_ms = platform.config.block_spacing_ms; // We do not need to perform these checks on genesis diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs index 1bf0ba9b8d3..8430b1a1fab 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/action_validation/document_replace_transition_action/structure_v0/mod.rs @@ -58,7 +58,7 @@ impl DocumentReplaceTransitionActionStructureValidationV0 for DocumentReplaceTra // Validate timestamps against block time // we do validation here but not in validate state because it's a cheap validation // and validate state implements expensive validation only - let latest_block_time_ms = platform.state.last_block_time_ms(); + let latest_block_time_ms = platform.state.last_committed_block_time_ms(); let average_block_spacing_ms = platform.config.block_spacing_ms; if let Some(latest_block_time_ms) = latest_block_time_ms { diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs index 42b07516598..61da179ca6f 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/dashpay/v0/mod.rs @@ -77,7 +77,7 @@ pub fn create_contact_request_data_trigger_v0( } if let Some(core_height_created_at) = maybe_core_height_created_at { - let core_chain_locked_height = context.platform.state.core_height(); + let core_chain_locked_height = context.platform.state.last_committed_core_height(); let height_window_start = core_chain_locked_height.saturating_sub(BLOCKS_SIZE_WINDOW); let height_window_end = core_chain_locked_height.saturating_add(BLOCKS_SIZE_WINDOW); diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs index 2a307ea5dae..6300fdcc57a 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/data_triggers/triggers/feature_flags/v0/mod.rs @@ -60,7 +60,7 @@ pub fn create_feature_flag_data_trigger_v0( ))) })?; - let latest_block_height = context.platform.state.height(); + let latest_block_height = context.platform.state.last_committed_height(); if enable_at_height < latest_block_height { let err = DataTriggerConditionError::new( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs index 1b55ac6a673..6ca0dc35441 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/documents_batch/state/v0/fetch_documents.rs @@ -82,7 +82,7 @@ pub(crate) fn fetch_documents_for_transitions_knowing_contract_id_and_document_t let add_to_cache_if_pulled = transaction.is_some(); let (_, contract_fetch_info) = drive.get_contract_with_fetch_info_and_fee( contract_id.to_buffer(), - Some(&platform.state.epoch()), + Some(&platform.state.last_committed_block_epoch()), add_to_cache_if_pulled, transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs index 335bec12a72..c8d7375dbf6 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs @@ -91,7 +91,7 @@ impl IdentityCreditWithdrawalStateTransitionStateValidationV0 &self, platform: &PlatformRef, ) -> Result, Error> { - let last_block_time = platform.state.last_block_time_ms().ok_or(Error::Execution( + let last_block_time = platform.state.last_committed_block_time_ms().ok_or(Error::Execution( ExecutionError::StateNotInitialized( "expected a last platform block during identity update validation", ), diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs index 7619699f122..b8faebfb233 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs @@ -123,7 +123,7 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition if let Some(disabled_at_ms) = self.public_keys_disabled_at() { // We need to verify the time the keys were disabled - let last_block_time = platform.state.last_block_time_ms().ok_or( + let last_block_time = platform.state.last_committed_block_time_ms().ok_or( Error::Execution(ExecutionError::StateNotInitialized( "expected a last platform block during identity update validation", )), diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index a9bc27646bc..036c82428a6 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -211,69 +211,69 @@ impl TryFromPlatformVersioned for PlatformState { } impl PlatformStateV0Methods for PlatformState { - fn height(&self) -> u64 { + fn last_committed_height(&self) -> u64 { match self { - PlatformState::V0(v0) => v0.height(), + PlatformState::V0(v0) => v0.last_committed_height(), } } - fn known_height_or(&self, default: u64) -> u64 { + fn last_committed_known_height_or(&self, default: u64) -> u64 { match self { - PlatformState::V0(v0) => v0.known_height_or(default), + PlatformState::V0(v0) => v0.last_committed_known_height_or(default), } } - fn core_height(&self) -> u32 { + fn last_committed_core_height(&self) -> u32 { match self { - PlatformState::V0(v0) => v0.core_height(), + PlatformState::V0(v0) => v0.last_committed_core_height(), } } - fn known_core_height_or(&self, default: u32) -> u32 { + fn last_committed_known_core_height_or(&self, default: u32) -> u32 { match self { - PlatformState::V0(v0) => v0.known_core_height_or(default), + PlatformState::V0(v0) => v0.last_committed_known_core_height_or(default), } } - fn last_block_time_ms(&self) -> Option { + fn last_committed_block_time_ms(&self) -> Option { match self { - PlatformState::V0(v0) => v0.last_block_time_ms(), + PlatformState::V0(v0) => v0.last_committed_block_time_ms(), } } - fn last_quorum_hash(&self) -> [u8; 32] { + fn last_committed_quorum_hash(&self) -> [u8; 32] { match self { - PlatformState::V0(v0) => v0.last_quorum_hash(), + PlatformState::V0(v0) => v0.last_committed_quorum_hash(), } } - fn last_block_signature(&self) -> [u8; 96] { + fn last_committed_block_signature(&self) -> [u8; 96] { match self { - PlatformState::V0(v0) => v0.last_block_signature(), + PlatformState::V0(v0) => v0.last_committed_block_signature(), } } - fn last_block_app_hash(&self) -> Option<[u8; 32]> { + fn last_committed_block_app_hash(&self) -> Option<[u8; 32]> { match self { - PlatformState::V0(v0) => v0.last_block_app_hash(), + PlatformState::V0(v0) => v0.last_committed_block_app_hash(), } } - fn last_block_height(&self) -> u64 { + fn last_committed_block_height(&self) -> u64 { match self { - PlatformState::V0(v0) => v0.last_block_height(), + PlatformState::V0(v0) => v0.last_committed_block_height(), } } - fn last_block_round(&self) -> u32 { + fn last_committed_block_round(&self) -> u32 { match self { - PlatformState::V0(v0) => v0.last_block_round(), + PlatformState::V0(v0) => v0.last_committed_block_round(), } } - fn epoch(&self) -> Epoch { + fn last_committed_block_epoch(&self) -> Epoch { match self { - PlatformState::V0(v0) => v0.epoch(), + PlatformState::V0(v0) => v0.last_committed_block_epoch(), } } @@ -403,6 +403,18 @@ impl PlatformStateV0Methods for PlatformState { } } + fn replace_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) -> BTreeMap { + match self { + PlatformState::V0(v0) => v0.replace_chain_lock_validating_quorums(quorums), + } + } + + fn set_previous_chain_lock_validating_quorums(&mut self, core_height: u32, quorums: BTreeMap) { + match self { + PlatformState::V0(v0) => v0.set_previous_chain_lock_validating_quorums(core_height, quorums), + } + } + fn set_full_masternode_list(&mut self, list: BTreeMap) { match self { PlatformState::V0(v0) => v0.set_full_masternode_list(list), @@ -463,6 +475,18 @@ impl PlatformStateV0Methods for PlatformState { } } + fn previous_height_chain_lock_validating_quorums(&self) -> Option<&(u32, BTreeMap)> { + match self { + PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums(), + } + } + + fn previous_height_chain_lock_validating_quorums_mut(&mut self) -> &mut Option<(u32, BTreeMap)> { + match self { + PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums_mut(), + } + } + fn full_masternode_list_mut(&mut self) -> &mut BTreeMap { match self { PlatformState::V0(v0) => v0.full_masternode_list_mut(), @@ -475,15 +499,15 @@ impl PlatformStateV0Methods for PlatformState { } } - fn epoch_ref(&self) -> &Epoch { + fn last_committed_block_epoch_ref(&self) -> &Epoch { match self { - PlatformState::V0(v0) => v0.epoch_ref(), + PlatformState::V0(v0) => v0.last_committed_block_epoch_ref(), } } - fn last_block_id_hash(&self) -> [u8; 32] { + fn last_committed_block_id_hash(&self) -> [u8; 32] { match self { - PlatformState::V0(v0) => v0.last_block_id_hash(), + PlatformState::V0(v0) => v0.last_committed_block_id_hash(), } } } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index e12825dbe74..eaf55e3252f 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -261,27 +261,27 @@ impl PlatformStateV0 { /// Platform state methods introduced in version 0 of Platform State Struct pub trait PlatformStateV0Methods { /// The height of the platform, only committed blocks increase height - fn height(&self) -> u64; + fn last_committed_height(&self) -> u64; /// The height of the platform, only committed blocks increase height - fn known_height_or(&self, default: u64) -> u64; + fn last_committed_known_height_or(&self, default: u64) -> u64; /// The height of the core blockchain that Platform knows about through chain locks - fn core_height(&self) -> u32; + fn last_committed_core_height(&self) -> u32; /// The height of the core blockchain that Platform knows about through chain locks - fn known_core_height_or(&self, default: u32) -> u32; + fn last_committed_known_core_height_or(&self, default: u32) -> u32; /// The last block time in milliseconds - fn last_block_time_ms(&self) -> Option; + fn last_committed_block_time_ms(&self) -> Option; /// The last quorum hash - fn last_quorum_hash(&self) -> [u8; 32]; + fn last_committed_quorum_hash(&self) -> [u8; 32]; /// The last block signature - fn last_block_signature(&self) -> [u8; 96]; + fn last_committed_block_signature(&self) -> [u8; 96]; /// The last block app hash - fn last_block_app_hash(&self) -> Option<[u8; 32]>; + fn last_committed_block_app_hash(&self) -> Option<[u8; 32]>; /// The last block height or 0 for genesis - fn last_block_height(&self) -> u64; + fn last_committed_block_height(&self) -> u64; /// The last block round - fn last_block_round(&self) -> u32; + fn last_committed_block_round(&self) -> u32; /// The current epoch - fn epoch(&self) -> Epoch; + fn last_committed_block_epoch(&self) -> Epoch; /// HPMN list len fn hpmn_list_len(&self) -> usize; /// Get the current quorum @@ -342,6 +342,12 @@ pub trait PlatformStateV0Methods { /// Sets the current chain lock validating quorums. fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap); + /// Sets the current chain lock validating quorums and returns the old value. + fn replace_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) -> BTreeMap; + + /// Sets the previous chain lock validating quorums. + fn set_previous_chain_lock_validating_quorums(&mut self, core_height: u32, quorums: BTreeMap); + /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap); @@ -371,6 +377,9 @@ pub trait PlatformStateV0Methods { /// Returns a mutable reference to the current chain lock validating quorums. fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap; + /// Returns a mutable reference to the previous chain lock validating quorums. + fn previous_height_chain_lock_validating_quorums_mut(&mut self) -> &mut Option<(u32, BTreeMap)>; + /// Returns a mutable reference to the full masternode list. fn full_masternode_list_mut(&mut self) -> &mut BTreeMap; @@ -378,14 +387,17 @@ pub trait PlatformStateV0Methods { fn hpmn_masternode_list_mut(&mut self) -> &mut BTreeMap; /// The epoch ref - fn epoch_ref(&self) -> &Epoch; + fn last_committed_block_epoch_ref(&self) -> &Epoch; /// The last block id hash - fn last_block_id_hash(&self) -> [u8; 32]; + fn last_committed_block_id_hash(&self) -> [u8; 32]; + + /// The previous height chain lock validating quorums + fn previous_height_chain_lock_validating_quorums(&self) -> Option<&(u32, BTreeMap)>; } impl PlatformStateV0Methods for PlatformStateV0 { /// The height of the platform, only committed blocks increase height - fn height(&self) -> u64 { + fn last_committed_height(&self) -> u64 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().height) @@ -393,7 +405,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The height of the platform, only committed blocks increase height - fn known_height_or(&self, default: u64) -> u64 { + fn last_committed_known_height_or(&self, default: u64) -> u64 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().height) @@ -401,7 +413,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The height of the core blockchain that Platform knows about through chain locks - fn core_height(&self) -> u32 { + fn last_committed_core_height(&self) -> u32 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().core_height) @@ -414,7 +426,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The height of the core blockchain that Platform knows about through chain locks - fn known_core_height_or(&self, default: u32) -> u32 { + fn last_committed_known_core_height_or(&self, default: u32) -> u32 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().core_height) @@ -427,14 +439,14 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block time in milliseconds - fn last_block_time_ms(&self) -> Option { + fn last_committed_block_time_ms(&self) -> Option { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().time_ms) } /// The last quorum hash - fn last_quorum_hash(&self) -> [u8; 32] { + fn last_committed_quorum_hash(&self) -> [u8; 32] { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.quorum_hash()) @@ -442,7 +454,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block id hash - fn last_block_id_hash(&self) -> [u8; 32] { + fn last_committed_block_id_hash(&self) -> [u8; 32] { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.block_id_hash()) @@ -450,7 +462,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block signature - fn last_block_signature(&self) -> [u8; 96] { + fn last_committed_block_signature(&self) -> [u8; 96] { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.signature()) @@ -458,14 +470,14 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block app hash - fn last_block_app_hash(&self) -> Option<[u8; 32]> { + fn last_committed_block_app_hash(&self) -> Option<[u8; 32]> { self.last_committed_block_info .as_ref() .map(|block_info| *block_info.app_hash()) } /// The last block height or 0 for genesis - fn last_block_height(&self) -> u64 { + fn last_committed_block_height(&self) -> u64 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().height) @@ -473,7 +485,7 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The last block round - fn last_block_round(&self) -> u32 { + fn last_committed_block_round(&self) -> u32 { self.last_committed_block_info .as_ref() .map(|block_info| block_info.round()) @@ -481,14 +493,14 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// The current epoch - fn epoch(&self) -> Epoch { + fn last_committed_block_epoch(&self) -> Epoch { self.last_committed_block_info .as_ref() .map(|block_info| block_info.basic_info().epoch) .unwrap_or_default() } - fn epoch_ref(&self) -> &Epoch { + fn last_committed_block_epoch_ref(&self) -> &Epoch { self.last_committed_block_info .as_ref() .map(|block_info| &block_info.basic_info().epoch) @@ -599,6 +611,16 @@ impl PlatformStateV0Methods for PlatformStateV0 { self.chain_lock_validating_quorums = quorums; } + /// Swaps the current chain lock validating quorums and returns the old one + fn replace_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) -> BTreeMap { + std::mem::replace(&mut self.chain_lock_validating_quorums, quorums) + } + + /// Sets the previous chain lock validating quorums. + fn set_previous_chain_lock_validating_quorums(&mut self, core_height: u32, quorums: BTreeMap) { + self.previous_height_chain_lock_validating_quorums = Some((core_height, quorums)); + } + /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap) { self.full_masternode_list = list; @@ -642,6 +664,14 @@ impl PlatformStateV0Methods for PlatformStateV0 { &mut self.chain_lock_validating_quorums } + fn previous_height_chain_lock_validating_quorums(&self) -> Option<&(u32, BTreeMap)> { + self.previous_height_chain_lock_validating_quorums.as_ref() + } + + fn previous_height_chain_lock_validating_quorums_mut(&mut self) -> &mut Option<(u32, BTreeMap)> { + &mut self.previous_height_chain_lock_validating_quorums + } + fn full_masternode_list_mut(&mut self) -> &mut BTreeMap { &mut self.full_masternode_list } diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs index 827db4d0087..39da61433cd 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract/v0/mod.rs @@ -39,11 +39,11 @@ impl Platform { version: Some(get_data_contract_response::Version::V0(GetDataContractResponseV0 { result: Some(get_data_contract_response::get_data_contract_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs index e9dfe8e7aa8..ad58118f603 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contract_history/v0/mod.rs @@ -66,11 +66,11 @@ impl Platform { version: Some(get_data_contract_history_response::Version::V0(GetDataContractHistoryResponseV0 { result: Some(get_data_contract_history_response::get_data_contract_history_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs index 882c9e4dd78..c3a2da2dc2d 100644 --- a/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/data_contract_based_queries/data_contracts/v0/mod.rs @@ -45,11 +45,11 @@ impl Platform { version: Some(get_data_contracts_response::Version::V0(GetDataContractsResponseV0 { result: Some(get_data_contracts_response::get_data_contracts_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/document_query/v0/mod.rs b/packages/rs-drive-abci/src/query/document_query/v0/mod.rs index b69ed92e3be..0f52f904e15 100644 --- a/packages/rs-drive-abci/src/query/document_query/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/document_query/v0/mod.rs @@ -147,11 +147,11 @@ impl Platform { get_documents_response::get_documents_response_v0::Result::Proof( Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }, ), ), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs index 8e956b6f5ad..e271ce29c54 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance/v0/mod.rs @@ -40,11 +40,11 @@ impl Platform { version: Some(get_identity_balance_response::Version::V0(GetIdentityBalanceResponseV0 { result: Some(get_identity_balance_response::get_identity_balance_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs index 79b842a90ca..2488a82fc23 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/balance_and_revision/v0/mod.rs @@ -44,11 +44,11 @@ impl Platform { version: Some(get_identity_balance_and_revision_response::Version::V0(GetIdentityBalanceAndRevisionResponseV0 { result: Some(get_identity_balance_and_revision_response::get_identity_balance_and_revision_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs index e05f2e4ed10..4ea7ad8fead 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identities/v0/mod.rs @@ -50,11 +50,11 @@ impl Platform { get_identities_response::get_identities_response_v0::Result::Proof( Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }, ), ), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs index 7fbacdc79d8..d6ed8f5b99d 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identities_by_public_key_hashes/v0/mod.rs @@ -56,11 +56,11 @@ impl Platform { version: Some(get_identities_by_public_key_hashes_response::Version::V0(GetIdentitiesByPublicKeyHashesResponseV0 { result: Some(get_identities_by_public_key_hashes_response::get_identities_by_public_key_hashes_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs index a4f849133f3..1fdc04da053 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity/v0/mod.rs @@ -42,11 +42,11 @@ impl Platform { result: Some( get_identity_response::get_identity_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }), ), metadata: Some(metadata), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs index 7bc82a33980..f25c0a85f2b 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/identity_by_public_key_hash/v0/mod.rs @@ -46,11 +46,11 @@ impl Platform { version: Some(get_identity_by_public_key_hash_response::Version::V0(GetIdentityByPublicKeyHashResponseV0 { result: Some(get_identity_by_public_key_hash_response::get_identity_by_public_key_hash_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs b/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs index 3f5b7a895e7..374057d1e35 100644 --- a/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/identity_based_queries/keys/v0/mod.rs @@ -142,11 +142,11 @@ impl Platform { version: Some(get_identity_keys_response::Version::V0(GetIdentityKeysResponseV0 { result: Some(get_identity_keys_response::get_identity_keys_response_v0::Result::Proof(Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), })), metadata: Some(metadata), })), diff --git a/packages/rs-drive-abci/src/query/proofs/v0/mod.rs b/packages/rs-drive-abci/src/query/proofs/v0/mod.rs index 480b6286f59..584eac412e6 100644 --- a/packages/rs-drive-abci/src/query/proofs/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/proofs/v0/mod.rs @@ -109,11 +109,11 @@ impl Platform { result: Some(get_proofs_response::get_proofs_response_v0::Result::Proof( Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }, )), metadata: Some(metadata), diff --git a/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs b/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs index a13e0878c53..492db68f4cf 100644 --- a/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/response_metadata/v0/mod.rs @@ -6,10 +6,10 @@ use dapi_grpc::platform::v0::ResponseMetadata; impl Platform { pub(in crate::query) fn response_metadata_v0(&self, state: &PlatformState) -> ResponseMetadata { ResponseMetadata { - height: state.height(), - core_chain_locked_height: state.core_height(), - epoch: state.epoch().index as u32, - time_ms: state.last_block_time_ms().unwrap_or_default(), + height: state.last_committed_height(), + core_chain_locked_height: state.last_committed_core_height(), + epoch: state.last_committed_block_epoch().index as u32, + time_ms: state.last_committed_block_time_ms().unwrap_or_default(), chain_id: self.config.abci.chain_id.clone(), protocol_version: state.current_protocol_version_in_consensus(), } diff --git a/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs b/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs index 84940037f04..a4961af007b 100644 --- a/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/epoch_infos/v0/mod.rs @@ -35,7 +35,7 @@ impl Platform { if ascending { 0 } else { - state.epoch_ref().index as u32 + state.last_committed_block_epoch_ref().index as u32 } }); @@ -70,11 +70,11 @@ impl Platform { get_epochs_info_response::get_epochs_info_response_v0::Result::Proof( Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }, ), ), diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs index a6595d6dc1c..44a2cbc283e 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_state/v0/mod.rs @@ -38,11 +38,11 @@ impl Platform { get_protocol_version_upgrade_state_response::get_protocol_version_upgrade_state_response_v0::Result::Proof( Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }, ), ), diff --git a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs index ff324df664c..661a2660114 100644 --- a/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/system/version_upgrade_vote_status/v0/mod.rs @@ -71,11 +71,11 @@ impl Platform { get_protocol_version_upgrade_vote_status_response::get_protocol_version_upgrade_vote_status_response_v0::Result::Proof( Proof { grovedb_proof: proof, - quorum_hash: state.last_quorum_hash().to_vec(), + quorum_hash: state.last_committed_quorum_hash().to_vec(), quorum_type, - block_id_hash: state.last_block_id_hash().to_vec(), - signature: state.last_block_signature().to_vec(), - round: state.last_block_round(), + block_id_hash: state.last_committed_block_id_hash().to_vec(), + signature: state.last_committed_block_signature().to_vec(), + round: state.last_committed_block_round(), }, ), ), diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index 0c5797719cb..bfca43a1d58 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -675,7 +675,7 @@ mod tests { .read() .expect("expected to read state"); let protocol_version = platform_state.current_protocol_version_in_consensus(); - let current_epoch = platform_state.epoch_ref().index; + let current_epoch = platform_state.last_committed_block_epoch_ref().index; drop(platform_state); let platform_version = PlatformVersion::get(protocol_version) .expect("expected to get current platform version"); diff --git a/packages/rs-platform-version/src/version/drive_abci_versions.rs b/packages/rs-platform-version/src/version/drive_abci_versions.rs index df2b737d5ee..b4eca9d9c14 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions.rs @@ -198,6 +198,7 @@ pub struct DriveAbciCoreSubsidyMethodVersions { #[derive(Clone, Debug, Default)] pub struct DriveAbciCoreChainLockMethodVersions { + pub choose_quorum: FeatureVersion, pub verify_chain_lock: FeatureVersion, pub verify_chain_lock_locally: FeatureVersion, pub verify_chain_lock_through_core: FeatureVersion, diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index f5b7f3a96ae..564d8474c2d 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -483,6 +483,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { epoch_core_reward_credits_for_distribution: 0, }, core_chain_lock: DriveAbciCoreChainLockMethodVersions { + choose_quorum: 0, verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 0e5c703140a..1b956e06eba 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -483,6 +483,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { epoch_core_reward_credits_for_distribution: 0, }, core_chain_lock: DriveAbciCoreChainLockMethodVersions { + choose_quorum: 0, verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index 4bcd6fea505..38eab49eb38 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -480,6 +480,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { epoch_core_reward_credits_for_distribution: 0, }, core_chain_lock: DriveAbciCoreChainLockMethodVersions { + choose_quorum: 0, verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, From 5fd5710cacca0fd4bad37151cce10dcf9ee55b3f Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 6 Dec 2023 22:46:51 +0700 Subject: [PATCH 05/51] fmt --- packages/rs-drive-abci/src/config.rs | 10 +- packages/rs-drive-abci/src/error/mod.rs | 2 +- .../engine/run_block_proposal/v0/mod.rs | 17 +++- .../update_core_info/v0/mod.rs | 5 +- .../update_quorum_info/v0/mod.rs | 63 +++++++----- .../core_chain_lock/choose_quorum/mod.rs | 22 +++-- .../core_chain_lock/choose_quorum/v0/mod.rs | 27 ++--- .../platform_events/core_chain_lock/mod.rs | 4 +- .../core_chain_lock/verify_chain_lock/mod.rs | 19 ++-- .../verify_chain_lock/v0/mod.rs | 21 ++-- .../verify_chain_lock_locally/mod.rs | 19 ++-- .../verify_chain_lock_locally/v0/mod.rs | 44 ++++++--- .../verify_chain_lock_through_core/mod.rs | 16 +-- .../verify_chain_lock_through_core/v0/mod.rs | 7 +- .../state/v0/mod.rs | 12 ++- .../identity_update/state/v0/mod.rs | 12 ++- .../src/platform_types/block_proposal/v0.rs | 41 ++++---- .../src/platform_types/platform_state/mod.rs | 34 +++++-- .../platform_types/platform_state/v0/mod.rs | 98 ++++++++++++++----- .../src/version/mocks/v2_test.rs | 19 +++- .../src/version/mocks/v3_test.rs | 19 +++- .../rs-platform-version/src/version/v1.rs | 19 +++- 22 files changed, 359 insertions(+), 171 deletions(-) diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index c1fceaa3965..7b493203085 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -248,7 +248,10 @@ impl PlatformConfig { }; if found == QuorumType::UNKNOWN { - panic!("config: unsupported QUORUM_TYPE: {}", self.validator_set_quorum_type); + panic!( + "config: unsupported QUORUM_TYPE: {}", + self.validator_set_quorum_type + ); } found @@ -263,7 +266,10 @@ impl PlatformConfig { }; if found == QuorumType::UNKNOWN { - panic!("config: unsupported QUORUM_TYPE: {}", self.chain_lock_quorum_type); + panic!( + "config: unsupported QUORUM_TYPE: {}", + self.chain_lock_quorum_type + ); } found diff --git a/packages/rs-drive-abci/src/error/mod.rs b/packages/rs-drive-abci/src/error/mod.rs index 89796a1c7c8..27300dc32cd 100644 --- a/packages/rs-drive-abci/src/error/mod.rs +++ b/packages/rs-drive-abci/src/error/mod.rs @@ -3,13 +3,13 @@ use crate::error::execution::ExecutionError; use crate::error::serialization::SerializationError; use crate::logging; use dashcore_rpc::Error as CoreRpcError; +use dpp::bls_signatures::BlsError; use dpp::platform_value::Error as ValueError; use dpp::version::PlatformVersionError; use drive::dpp::ProtocolError; use drive::error::Error as DriveError; use tenderdash_abci::proto::abci::ResponseException; use tracing::error; -use dpp::bls_signatures::BlsError; /// Execution errors module pub mod execution; diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 5651148e1a3..cf906b7eee1 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -125,12 +125,19 @@ where // If there is a core chain lock update, we should start by verifying it if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { - let valid = self.verify_chain_lock(&block_platform_state, core_chain_lock_update, platform_version)?; + let valid = self.verify_chain_lock( + &block_platform_state, + core_chain_lock_update, + platform_version, + )?; if !valid { - return Ok(ValidationResult::new_with_error(AbciError::InvalidChainLock(format!( - "received a chain lock for height {} that is invalid {:?}", - block_info.height, core_chain_lock_update, - )).into())) + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs index 1273cce508a..912114b1bba 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_core_info/v0/mod.rs @@ -1,11 +1,11 @@ use crate::error::Error; use crate::platform_types::platform::Platform; +use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; use dpp::block::block_info::BlockInfo; use dpp::version::PlatformVersion; use drive::grovedb::Transaction; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; impl Platform where @@ -42,7 +42,8 @@ where platform_version: &PlatformVersion, ) -> Result<(), Error> { // the core height of the block platform state is the last committed - if !is_init_chain && block_platform_state.last_committed_core_height() == core_block_height { + if !is_init_chain && block_platform_state.last_committed_core_height() == core_block_height + { // if we get the same height that we know we do not need to update core info return Ok(()); } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index a4913fa4451..ebfe7f2ac1d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -9,9 +9,9 @@ use crate::platform_types::validator_set::v0::{ValidatorSetV0, ValidatorSetV0Get use crate::platform_types::validator_set::ValidatorSet; use crate::rpc::core::CoreRPCLike; +use dpp::bls_signatures::PublicKey as BlsPublicKey; use dpp::dashcore::QuorumHash; use tracing::Level; -use dpp::bls_signatures::PublicKey as BlsPublicKey; impl Platform where @@ -93,9 +93,11 @@ where .contains_key::(key) }) .map(|(key, _)| { - let quorum_info_result = - self.core_rpc - .get_quorum_info(self.config.validator_set_quorum_type(), key, None)?; + let quorum_info_result = self.core_rpc.get_quorum_info( + self.config.validator_set_quorum_type(), + key, + None, + )?; Ok((*key, quorum_info_result)) }) @@ -158,12 +160,22 @@ where if validator_set_quorum_type == chain_lock_quorum_type { // Remove validator_sets entries that are no longer valid for the core block height if removed_a_validator_set || added_a_validator_set { - let chain_lock_validating_quorums = block_platform_state.validator_sets().iter().map(|(quorum_hash, validator_set)| { - (quorum_hash.clone(), validator_set.threshold_public_key().clone()) - }).collect(); + let chain_lock_validating_quorums = block_platform_state + .validator_sets() + .iter() + .map(|(quorum_hash, validator_set)| { + ( + quorum_hash.clone(), + validator_set.threshold_public_key().clone(), + ) + }) + .collect(); let previous_quorums = block_platform_state .replace_chain_lock_validating_quorums(chain_lock_validating_quorums); - block_platform_state.set_previous_chain_lock_validating_quorums(block_platform_state.last_committed_core_height(), previous_quorums); + block_platform_state.set_previous_chain_lock_validating_quorums( + block_platform_state.last_committed_core_height(), + previous_quorums, + ); } } else { let chain_lock_quorums_list: BTreeMap<_, _> = extended_quorum_list @@ -175,9 +187,10 @@ where self.config.chain_lock_quorum_type ), )))? - .into_iter().map(|(quorum_hash, extended_quorum_details)| { - (quorum_hash, extended_quorum_details.quorum_index) - }) + .into_iter() + .map(|(quorum_hash, extended_quorum_details)| { + (quorum_hash, extended_quorum_details.quorum_index) + }) .collect(); let mut removed_a_chain_lock_validating_quorum = false; @@ -215,21 +228,23 @@ where let new_chain_lock_quorums = quorum_infos .into_iter() .map(|(quorum_hash, info_result)| { - let public_key = match BlsPublicKey::from_bytes(info_result.quorum_public_key.as_slice()) - .map_err(ExecutionError::BlsErrorFromDashCoreResponse) + let public_key = match BlsPublicKey::from_bytes( + info_result.quorum_public_key.as_slice(), + ) + .map_err(ExecutionError::BlsErrorFromDashCoreResponse) { Ok(public_key) => public_key, Err(e) => return Err(e.into()), }; tracing::trace!( - ?public_key, - ?quorum_hash, - quorum_type = ?chain_lock_quorum_type, - "add new chain lock quorum {} with quorum type {}", - quorum_hash, - chain_lock_quorum_type - ); + ?public_key, + ?quorum_hash, + quorum_type = ?chain_lock_quorum_type, + "add new chain lock quorum {} with quorum type {}", + quorum_hash, + chain_lock_quorum_type + ); Ok((quorum_hash, public_key)) }) @@ -243,8 +258,12 @@ where if added_a_chain_lock_validating_quorum || removed_a_chain_lock_validating_quorum { if let Some(old_state) = platform_state { - let previous_chain_lock_validating_quorums = old_state.chain_lock_validating_quorums().clone(); - block_platform_state.set_previous_chain_lock_validating_quorums(block_platform_state.last_committed_core_height(), previous_chain_lock_validating_quorums); + let previous_chain_lock_validating_quorums = + old_state.chain_lock_validating_quorums().clone(); + block_platform_state.set_previous_chain_lock_validating_quorums( + block_platform_state.last_committed_core_height(), + previous_chain_lock_validating_quorums, + ); } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs index f2fdd129314..e6969fa2ab7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -1,12 +1,12 @@ mod v0; -use std::collections::BTreeMap; +use crate::error::execution::ExecutionError; +use crate::error::Error; use dashcore_rpc::dashcore_rpc_json::QuorumType; use dpp::bls_signatures::PublicKey as BlsPublicKey; use dpp::dashcore::{ChainLock, QuorumHash}; use dpp::platform_value::Bytes32; -use crate::error::execution::ExecutionError; -use crate::error::Error; +use std::collections::BTreeMap; use crate::platform_types::platform::Platform; @@ -15,21 +15,25 @@ use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums /// - pub fn choose_quorum<'a>(&self, llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8;32], platform_version: &PlatformVersion) -> Result, Error> { + pub fn choose_quorum<'a>( + &self, + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + platform_version: &PlatformVersion, + ) -> Result, Error> { match platform_version .drive_abci .methods .core_chain_lock .choose_quorum { - 0 => { - Ok(self.choose_quorum_v0(llmq_quorum_type, quorums, request_id, platform_version)) - } + 0 => Ok(self.choose_quorum_v0(llmq_quorum_type, quorums, request_id, platform_version)), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "choose_quorum".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index e0184364c9a..6120dbcb410 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -1,13 +1,11 @@ - - -use std::collections::BTreeMap; +use crate::error::Error; use dashcore_rpc::dashcore_rpc_json::QuorumType; -use sha2::Sha256; use dpp::bls_signatures::PublicKey as BlsPublicKey; +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; use dpp::dashcore::{ChainLock, QuorumHash}; -use dpp::dashcore::hashes::{Hash, HashEngine, sha256d}; use dpp::platform_value::Bytes32; -use crate::error::Error; +use sha2::Sha256; +use std::collections::BTreeMap; use crate::platform_types::platform::Platform; @@ -16,13 +14,19 @@ use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums - pub(super) fn choose_quorum_v0<'a>(&self, llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8;32], _platform_version: &PlatformVersion) -> Option<(&'a QuorumHash, &'a BlsPublicKey)> { + pub(super) fn choose_quorum_v0<'a>( + &self, + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + _platform_version: &PlatformVersion, + ) -> Option<(&'a QuorumHash, &'a BlsPublicKey)> { // Scoring system logic - let mut scores: Vec<(&QuorumHash, &BlsPublicKey, [u8;32])> = Vec::new(); + let mut scores: Vec<(&QuorumHash, &BlsPublicKey, [u8; 32])> = Vec::new(); for (quorum_hash, public_key) in quorums { let mut hasher = sha256d::Hash::engine(); @@ -38,11 +42,10 @@ impl Platform // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); - scores.push((quorum_hash, public_key, hash_result.into())); + scores.push((quorum_hash, public_key, hash_result.into())); } scores.sort_by_key(|k| k.2); scores.first().map(|&(hash, key, _)| (hash, key)) } - } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index 76a70aaae80..ebac3605176 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -1,4 +1,4 @@ +mod choose_quorum; +mod verify_chain_lock; mod verify_chain_lock_locally; mod verify_chain_lock_through_core; -mod verify_chain_lock; -mod choose_quorum; \ No newline at end of file diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index 11a4f20c901..7926b8c58af 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -1,31 +1,34 @@ mod v0; -use dpp::dashcore::ChainLock; use crate::error::execution::ExecutionError; use crate::error::Error; +use dpp::dashcore::ChainLock; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Verify the chain lock - pub fn verify_chain_lock(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + pub fn verify_chain_lock( + &self, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { match platform_version .drive_abci .methods .core_chain_lock .verify_chain_lock { - 0 => { - self.verify_chain_lock_v0( platform_state, chain_lock, platform_version) - } + 0 => self.verify_chain_lock_v0(platform_state, chain_lock, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index a8da73b63d9..c3c1f655227 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -1,22 +1,27 @@ - +use crate::error::Error; use dpp::dashcore::ChainLock; use dpp::version::PlatformVersion; -use crate::error::Error; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::PlatformState; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { - pub(super) fn verify_chain_lock_v0(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { - + pub(super) fn verify_chain_lock_v0( + &self, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { // first we try to verify the chain lock locally - if let Some(valid) = self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? { + if let Some(valid) = + self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? + { Ok(valid) } else { // if we were not able to validate it locally then we should go to core diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs index 12878af2a42..0c9e41ae16c 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -1,32 +1,35 @@ mod v0; -use dpp::dashcore::ChainLock; use crate::error::execution::ExecutionError; use crate::error::Error; +use dpp::dashcore::ChainLock; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Returning None here means we were unable to verify the chain lock because of an absence of /// the quorum - pub fn verify_chain_lock_locally(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { + pub fn verify_chain_lock_locally( + &self, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result, Error> { match platform_version .drive_abci .methods .core_chain_lock .verify_chain_lock_locally { - 0 => { - self.verify_chain_lock_locally_v0(platform_state, chain_lock, platform_version) - } + 0 => self.verify_chain_lock_locally_v0(platform_state, chain_lock, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock_locally".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 278ac10232d..f65d109a8e0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -1,7 +1,7 @@ use dpp::bls_signatures::G2Element; -use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; use dpp::dashcore::consensus::Encodable; -use dpp::dashcore::hashes::{Hash, HashEngine, sha256d}; +use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; +use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; use crate::error::Error; @@ -9,20 +9,24 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; -use crate::platform_types::platform_state::PlatformState; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::platform_state::PlatformState; +use dpp::version::PlatformVersion; const CHAIN_LOCK_REQUEST_ID_PREFIX: &str = "clsig"; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Returning None here means we were unable to verify the chain lock because of an absence of /// the quorum - pub fn verify_chain_lock_locally_v0(&self, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result, Error> { - + pub fn verify_chain_lock_locally_v0( + &self, + platform_state: &PlatformState, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result, Error> { // First verify that the signature conforms to a signature let signature = G2Element::from_bytes(chain_lock.signature.as_bytes())?; @@ -32,15 +36,20 @@ impl Platform let window_width = 578; // The last block in the window where the quorums would be the same - let last_block_in_window = platform_state.last_committed_core_height() - platform_state.last_committed_core_height() % window_width + window_width - 1; + let last_block_in_window = platform_state.last_committed_core_height() + - platform_state.last_committed_core_height() % window_width + + window_width + - 1; let verification_height = chain_lock.block_height - 8; - if verification_height > last_block_in_window { + if verification_height > last_block_in_window { return Ok(None); // the chain lock is too far in the future or the past to verify locally } - let quorums = if let Some((previous_quorum_height, previous_quorums)) = platform_state.previous_height_chain_lock_validating_quorums() { + let quorums = if let Some((previous_quorum_height, previous_quorums)) = + platform_state.previous_height_chain_lock_validating_quorums() + { if chain_lock_height > 8 && chain_lock_height - 8 <= *previous_quorum_height { // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock previous_quorums @@ -58,7 +67,9 @@ impl Platform // Prefix let prefix_len = VarInt(CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u64); - prefix_len.consensus_encode(&mut engine).expect("expected to encode the prefix"); + prefix_len + .consensus_encode(&mut engine) + .expect("expected to encode the prefix"); engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); engine.input(chain_lock.block_height.to_be_bytes().as_slice()); @@ -67,7 +78,12 @@ impl Platform // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined - let quorum = self.choose_quorum(self.config.chain_lock_quorum_type(), quorums, request_id.as_ref(), platform_version)?; + let quorum = self.choose_quorum( + self.config.chain_lock_quorum_type(), + quorums, + request_id.as_ref(), + platform_version, + )?; let Some((quorum_hash, public_key)) = quorum else { return Ok(None); @@ -86,6 +102,6 @@ impl Platform let chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); - return Ok(Some(chain_lock_verified)) + return Ok(Some(chain_lock_verified)); } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs index f5b4dcfd640..33c0227b013 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -1,8 +1,8 @@ mod v0; -use dpp::dashcore::ChainLock; use crate::error::execution::ExecutionError; use crate::error::Error; +use dpp::dashcore::ChainLock; use crate::platform_types::platform::Platform; @@ -11,20 +11,22 @@ use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Verify the chain lock through core - pub fn verify_chain_lock_through_core(&self, chain_lock: &ChainLock, platform_version: &PlatformVersion) -> Result { + pub fn verify_chain_lock_through_core( + &self, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result { match platform_version .drive_abci .methods .core_chain_lock .verify_chain_lock_through_core { - 0 => { - self.verify_chain_lock_through_core_v0(chain_lock) - } + 0 => self.verify_chain_lock_through_core_v0(chain_lock), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock_through_core".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs index 342f0e099b7..e6f35c64a6d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -1,17 +1,16 @@ -use dpp::dashcore::ChainLock; use crate::error::Error; +use dpp::dashcore::ChainLock; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// Verify the chain lock through core v0 pub fn verify_chain_lock_through_core_v0(&self, chain_lock: &ChainLock) -> Result { - // Should we have a max height here? let valid = self.core_rpc.verify_chain_lock(chain_lock, None)?; diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs index c8d7375dbf6..aef587218ef 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_credit_withdrawal/state/v0/mod.rs @@ -91,11 +91,13 @@ impl IdentityCreditWithdrawalStateTransitionStateValidationV0 &self, platform: &PlatformRef, ) -> Result, Error> { - let last_block_time = platform.state.last_committed_block_time_ms().ok_or(Error::Execution( - ExecutionError::StateNotInitialized( - "expected a last platform block during identity update validation", - ), - ))?; + let last_block_time = + platform + .state + .last_committed_block_time_ms() + .ok_or(Error::Execution(ExecutionError::StateNotInitialized( + "expected a last platform block during identity update validation", + )))?; Ok(ConsensusValidationResult::new_with_data( IdentityCreditWithdrawalTransitionAction::from_identity_credit_withdrawal( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs index b8faebfb233..828635abb09 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v0/mod.rs @@ -123,11 +123,13 @@ impl IdentityUpdateStateTransitionStateValidationV0 for IdentityUpdateTransition if let Some(disabled_at_ms) = self.public_keys_disabled_at() { // We need to verify the time the keys were disabled - let last_block_time = platform.state.last_committed_block_time_ms().ok_or( - Error::Execution(ExecutionError::StateNotInitialized( - "expected a last platform block during identity update validation", - )), - )?; + let last_block_time = + platform + .state + .last_committed_block_time_ms() + .ok_or(Error::Execution(ExecutionError::StateNotInitialized( + "expected a last platform block during identity update validation", + )))?; let window_validation_result = validate_time_in_block_time_window( last_block_time, diff --git a/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs b/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs index 652c4fee143..7ed2273d95d 100644 --- a/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs +++ b/packages/rs-drive-abci/src/platform_types/block_proposal/v0.rs @@ -1,14 +1,14 @@ use crate::abci::AbciError; use crate::error::Error; +use dpp::dashcore::bls_sig_utils::BLSSignature; +use dpp::dashcore::hashes::Hash; +use dpp::dashcore::{BlockHash, ChainLock}; +use dpp::platform_value::Bytes32; use std::fmt; use tenderdash_abci::proto::abci::{RequestPrepareProposal, RequestProcessProposal}; use tenderdash_abci::proto::serializers::timestamp::ToMilis; use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::proto::version::Consensus; -use dpp::dashcore::bls_sig_utils::BLSSignature; -use dpp::dashcore::{BlockHash, ChainLock}; -use dpp::dashcore::hashes::Hash; -use dpp::platform_value::Bytes32; /// The block proposal is the combination of information that a proposer will propose, /// Or that a validator or full node will process @@ -216,25 +216,28 @@ impl<'a> TryFrom<&'a RequestProcessProposal> for BlockProposal<'a> { .into()); } - let core_chain_lock_update = core_chain_lock_update.as_ref().map(|core_chain_lock| { - let CoreChainLock { - core_block_height, core_block_hash, signature - } = core_chain_lock; + let core_chain_lock_update = core_chain_lock_update + .as_ref() + .map(|core_chain_lock| { + let CoreChainLock { + core_block_height, + core_block_hash, + signature, + } = core_chain_lock; - let block_hash : Bytes32 = Bytes32::from_vec(core_block_hash.clone())?; + let block_hash: Bytes32 = Bytes32::from_vec(core_block_hash.clone())?; - let signature : [u8;96] = signature.clone().try_into().map_err(|_| { - AbciError::BadRequest( - "core chain lock signature not 96 bytes".to_string(), - ) - })?; + let signature: [u8; 96] = signature.clone().try_into().map_err(|_| { + AbciError::BadRequest("core chain lock signature not 96 bytes".to_string()) + })?; - Ok::(ChainLock { - block_height: *core_block_height, - block_hash: BlockHash::from_byte_array(block_hash.0), - signature: BLSSignature::from(signature), + Ok::(ChainLock { + block_height: *core_block_height, + block_hash: BlockHash::from_byte_array(block_hash.0), + signature: BLSSignature::from(signature), + }) }) - }).transpose()?; + .transpose()?; Ok(Self { consensus_versions, block_hash: Some(block_hash), diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index 036c82428a6..cecb9e0acc3 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -25,9 +25,9 @@ use indexmap::IndexMap; use crate::error::execution::ExecutionError; use dpp::block::block_info::BlockInfo; +use dpp::bls_signatures::PublicKey as ThresholdBlsPublicKey; use dpp::util::hash::hash; use std::collections::BTreeMap; -use dpp::bls_signatures::{PublicKey as ThresholdBlsPublicKey}; /// Platform state #[derive(Clone, Debug, From)] @@ -397,21 +397,33 @@ impl PlatformStateV0Methods for PlatformState { } } - fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) { + fn set_chain_lock_validating_quorums( + &mut self, + quorums: BTreeMap, + ) { match self { PlatformState::V0(v0) => v0.set_chain_lock_validating_quorums(quorums), } } - fn replace_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) -> BTreeMap { + fn replace_chain_lock_validating_quorums( + &mut self, + quorums: BTreeMap, + ) -> BTreeMap { match self { PlatformState::V0(v0) => v0.replace_chain_lock_validating_quorums(quorums), } } - fn set_previous_chain_lock_validating_quorums(&mut self, core_height: u32, quorums: BTreeMap) { + fn set_previous_chain_lock_validating_quorums( + &mut self, + core_height: u32, + quorums: BTreeMap, + ) { match self { - PlatformState::V0(v0) => v0.set_previous_chain_lock_validating_quorums(core_height, quorums), + PlatformState::V0(v0) => { + v0.set_previous_chain_lock_validating_quorums(core_height, quorums) + } } } @@ -469,19 +481,25 @@ impl PlatformStateV0Methods for PlatformState { } } - fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap { + fn chain_lock_validating_quorums_mut( + &mut self, + ) -> &mut BTreeMap { match self { PlatformState::V0(v0) => v0.chain_lock_validating_quorums_mut(), } } - fn previous_height_chain_lock_validating_quorums(&self) -> Option<&(u32, BTreeMap)> { + fn previous_height_chain_lock_validating_quorums( + &self, + ) -> Option<&(u32, BTreeMap)> { match self { PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums(), } } - fn previous_height_chain_lock_validating_quorums_mut(&mut self) -> &mut Option<(u32, BTreeMap)> { + fn previous_height_chain_lock_validating_quorums_mut( + &mut self, + ) -> &mut Option<(u32, BTreeMap)> { match self { PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums_mut(), } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index eaf55e3252f..3d2414fab11 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -17,11 +17,11 @@ use crate::platform_types::masternode::Masternode; use crate::platform_types::validator_set::ValidatorSet; use dpp::block::block_info::{BlockInfo, DEFAULT_BLOCK_INFO}; use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; +use dpp::bls_signatures::PublicKey as ThresholdBlsPublicKey; use dpp::version::{PlatformVersion, TryIntoPlatformVersioned}; +use drive::grovedb::batch::Op; use std::collections::BTreeMap; use std::fmt::{Debug, Formatter}; -use dpp::bls_signatures::{PublicKey as ThresholdBlsPublicKey}; -use drive::grovedb::batch::Op; /// Platform state #[derive(Clone)] @@ -49,7 +49,8 @@ pub struct PlatformStateV0 { /// The slightly old 400 60 quorums used for validating chain locks, it's important to keep /// these because validation of signatures happens for the quorums that are 8 blocks before the /// height written in the chain lock - pub previous_height_chain_lock_validating_quorums: Option<(u32, BTreeMap)>, + pub previous_height_chain_lock_validating_quorums: + Option<(u32, BTreeMap)>, /// current full masternode list pub full_masternode_list: BTreeMap, @@ -127,7 +128,8 @@ pub(super) struct PlatformStateForSavingV0 { /// The 400 60 quorums used for validating chain locks from a slightly previous height. #[bincode(with_serde)] - pub previous_height_chain_lock_validating_quorums: Option<(u32, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, + pub previous_height_chain_lock_validating_quorums: + Option<(u32, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, /// current full masternode list pub full_masternode_list: BTreeMap, @@ -164,11 +166,16 @@ impl TryFrom for PlatformStateForSavingV0 { .map(|(k, v)| (k.to_byte_array().into(), v)) .collect(), previous_height_chain_lock_validating_quorums: value - .previous_height_chain_lock_validating_quorums.map(|(previous_height, inner_value)| { - (previous_height, inner_value.into_iter() - .map(|(k, v)| (k.to_byte_array().into(), v)) - .collect()) - }), + .previous_height_chain_lock_validating_quorums + .map(|(previous_height, inner_value)| { + ( + previous_height, + inner_value + .into_iter() + .map(|(k, v)| (k.to_byte_array().into(), v)) + .collect(), + ) + }), full_masternode_list: value .full_masternode_list .into_iter() @@ -216,12 +223,17 @@ impl From for PlatformStateV0 { .into_iter() .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) .collect(), - previous_height_chain_lock_validating_quorums: value.previous_height_chain_lock_validating_quorums.map(|(previous_height, inner_value)| { - (previous_height, inner_value.into_iter() - .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) - .collect()) - }) - , + previous_height_chain_lock_validating_quorums: value + .previous_height_chain_lock_validating_quorums + .map(|(previous_height, inner_value)| { + ( + previous_height, + inner_value + .into_iter() + .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) + .collect(), + ) + }), full_masternode_list: value .full_masternode_list .into_iter() @@ -340,13 +352,23 @@ pub trait PlatformStateV0Methods { fn set_validator_sets(&mut self, sets: IndexMap); /// Sets the current chain lock validating quorums. - fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap); + fn set_chain_lock_validating_quorums( + &mut self, + quorums: BTreeMap, + ); /// Sets the current chain lock validating quorums and returns the old value. - fn replace_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) -> BTreeMap; + fn replace_chain_lock_validating_quorums( + &mut self, + quorums: BTreeMap, + ) -> BTreeMap; /// Sets the previous chain lock validating quorums. - fn set_previous_chain_lock_validating_quorums(&mut self, core_height: u32, quorums: BTreeMap); + fn set_previous_chain_lock_validating_quorums( + &mut self, + core_height: u32, + quorums: BTreeMap, + ); /// Sets the full masternode list. fn set_full_masternode_list(&mut self, list: BTreeMap); @@ -375,10 +397,14 @@ pub trait PlatformStateV0Methods { fn validator_sets_mut(&mut self) -> &mut IndexMap; /// Returns a mutable reference to the current chain lock validating quorums. - fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap; + fn chain_lock_validating_quorums_mut( + &mut self, + ) -> &mut BTreeMap; /// Returns a mutable reference to the previous chain lock validating quorums. - fn previous_height_chain_lock_validating_quorums_mut(&mut self) -> &mut Option<(u32, BTreeMap)>; + fn previous_height_chain_lock_validating_quorums_mut( + &mut self, + ) -> &mut Option<(u32, BTreeMap)>; /// Returns a mutable reference to the full masternode list. fn full_masternode_list_mut(&mut self) -> &mut BTreeMap; @@ -392,7 +418,9 @@ pub trait PlatformStateV0Methods { fn last_committed_block_id_hash(&self) -> [u8; 32]; /// The previous height chain lock validating quorums - fn previous_height_chain_lock_validating_quorums(&self) -> Option<&(u32, BTreeMap)>; + fn previous_height_chain_lock_validating_quorums( + &self, + ) -> Option<&(u32, BTreeMap)>; } impl PlatformStateV0Methods for PlatformStateV0 { @@ -607,17 +635,27 @@ impl PlatformStateV0Methods for PlatformStateV0 { } /// Sets the current chain lock validating quorums. - fn set_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) { + fn set_chain_lock_validating_quorums( + &mut self, + quorums: BTreeMap, + ) { self.chain_lock_validating_quorums = quorums; } /// Swaps the current chain lock validating quorums and returns the old one - fn replace_chain_lock_validating_quorums(&mut self, quorums: BTreeMap) -> BTreeMap { + fn replace_chain_lock_validating_quorums( + &mut self, + quorums: BTreeMap, + ) -> BTreeMap { std::mem::replace(&mut self.chain_lock_validating_quorums, quorums) } /// Sets the previous chain lock validating quorums. - fn set_previous_chain_lock_validating_quorums(&mut self, core_height: u32, quorums: BTreeMap) { + fn set_previous_chain_lock_validating_quorums( + &mut self, + core_height: u32, + quorums: BTreeMap, + ) { self.previous_height_chain_lock_validating_quorums = Some((core_height, quorums)); } @@ -660,15 +698,21 @@ impl PlatformStateV0Methods for PlatformStateV0 { &mut self.validator_sets } - fn chain_lock_validating_quorums_mut(&mut self) -> &mut BTreeMap { + fn chain_lock_validating_quorums_mut( + &mut self, + ) -> &mut BTreeMap { &mut self.chain_lock_validating_quorums } - fn previous_height_chain_lock_validating_quorums(&self) -> Option<&(u32, BTreeMap)> { + fn previous_height_chain_lock_validating_quorums( + &self, + ) -> Option<&(u32, BTreeMap)> { self.previous_height_chain_lock_validating_quorums.as_ref() } - fn previous_height_chain_lock_validating_quorums_mut(&mut self) -> &mut Option<(u32, BTreeMap)> { + fn previous_height_chain_lock_validating_quorums_mut( + &mut self, + ) -> &mut Option<(u32, BTreeMap)> { &mut self.previous_height_chain_lock_validating_quorums } diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 564d8474c2d..92bb19a79ba 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -9,7 +9,24 @@ use crate::version::dpp_versions::{ RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, }; -use crate::version::drive_abci_versions::{DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions}; +use crate::version::drive_abci_versions::{ + DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, + DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, + DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, + DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, + DriveAbciFeePoolInwardsDistributionMethodVersions, + DriveAbciFeePoolOutwardsDistributionMethodVersions, + DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, + DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, + DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, + DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, + DriveAbciStateTransitionCommonValidationVersions, + DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, + DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, + DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, + DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, +}; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, DriveContractApplyMethodVersions, DriveContractCostsMethodVersions, diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 1b956e06eba..76b454c2eaa 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -9,7 +9,24 @@ use crate::version::dpp_versions::{ RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, }; -use crate::version::drive_abci_versions::{DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions}; +use crate::version::drive_abci_versions::{ + DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, + DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, + DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, + DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, + DriveAbciFeePoolInwardsDistributionMethodVersions, + DriveAbciFeePoolOutwardsDistributionMethodVersions, + DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, + DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, + DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, + DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, + DriveAbciStateTransitionCommonValidationVersions, + DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, + DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, + DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, + DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, +}; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, DriveContractApplyMethodVersions, DriveContractCostsMethodVersions, diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index 38eab49eb38..b6cd61a0eea 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -9,7 +9,24 @@ use crate::version::dpp_versions::{ RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, }; -use crate::version::drive_abci_versions::{DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, DriveAbciFeePoolOutwardsDistributionMethodVersions, DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, DriveAbciStateTransitionCommonValidationVersions, DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions}; +use crate::version::drive_abci_versions::{ + DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, + DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, + DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, + DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, + DriveAbciFeePoolInwardsDistributionMethodVersions, + DriveAbciFeePoolOutwardsDistributionMethodVersions, + DriveAbciIdentityCreditWithdrawalMethodVersions, DriveAbciInitializationMethodVersions, + DriveAbciMasternodeIdentitiesUpdatesMethodVersions, DriveAbciMethodVersions, + DriveAbciProtocolUpgradeMethodVersions, DriveAbciQueryDataContractVersions, + DriveAbciQueryIdentityVersions, DriveAbciQuerySystemVersions, DriveAbciQueryVersions, + DriveAbciStateTransitionCommonValidationVersions, + DriveAbciStateTransitionProcessingMethodVersions, DriveAbciStateTransitionValidationVersion, + DriveAbciStateTransitionValidationVersions, DriveAbciStructureVersions, + DriveAbciValidationDataTriggerAndBindingVersions, DriveAbciValidationDataTriggerVersions, + DriveAbciValidationVersions, DriveAbciVersion, DriveAbciWithdrawalsMethodVersions, +}; use crate::version::drive_versions::{ DriveAssetLockMethodVersions, DriveBalancesMethodVersions, DriveBatchOperationsMethodVersion, DriveContractApplyMethodVersions, DriveContractCostsMethodVersions, From 313c49b6f38293f3b2a97281560d9f07a533e834 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 11 Dec 2023 17:47:28 +0700 Subject: [PATCH 06/51] more work --- .../make_sure_core_is_synced_to_height/mod.rs | 42 +++++++++++++++++++ .../v0/mod.rs | 26 ++++++++++++ .../platform_events/core_chain_lock/mod.rs | 2 + .../src/version/drive_abci_versions.rs | 1 + 4 files changed, 71 insertions(+) create mode 100644 packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs create mode 100644 packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs new file mode 100644 index 00000000000..25fb6baa901 --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs @@ -0,0 +1,42 @@ +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; +use crate::error::Error; +use crate::error::execution::ExecutionError; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; + +/// Version 0 +pub mod v0; + +impl Platform + where + C: CoreRPCLike, +{ + /// The point of this call is to make sure core is synced. + /// Before this call we had previously validated that the chain lock is valid. + /// The core height passed here is the core height that we need to be able to validate all asset lock proofs. + /// It should be chosen by taking the highest height of all state transitions that require core. + /// State transitions that require core are: + /// *Identity Create State transition + /// *Identity Top up State transition + pub fn make_sure_core_is_synced_to_height( + &self, + core_height: u32, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .make_sure_core_is_synced_to_height + { + 0 => Ok(self.make_sure_core_is_synced_to_height_v0(core_height, chain_lock, platform_version)), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "make_sure_core_is_synced_to_height".to_string(), + known_versions: vec![0], + received: version, + })), + } + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs new file mode 100644 index 00000000000..50d6883eddb --- /dev/null +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs @@ -0,0 +1,26 @@ +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; +use crate::error::Error; +use crate::platform_types::platform::Platform; +use crate::rpc::core::CoreRPCLike; + +impl Platform + where + C: CoreRPCLike, +{ + /// The point of this call is to make sure core is synced. + /// Before this call we had previously validated that the chain lock is valid. + pub(super) fn make_sure_core_is_synced_to_height_v0( + &self, + chain_lock: &ChainLock, + platform_version: &PlatformVersion, + ) -> Result<(), Error> { + // We need to make sure core is synced to the core height we see as valid for the state transitions + + // First we must ask core for the locked core height + + let best_core_chain_lock = self.core_rpc.get_best_chain_lock()?; + + // If the best core chain lock height is higher than that current chain lock + } +} \ No newline at end of file diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index ebac3605176..2e09e016c91 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -2,3 +2,5 @@ mod choose_quorum; mod verify_chain_lock; mod verify_chain_lock_locally; mod verify_chain_lock_through_core; +mod make_sure_core_is_synced_to_height; +mod make_sure_core_is_synced_for_state_transitions; diff --git a/packages/rs-platform-version/src/version/drive_abci_versions.rs b/packages/rs-platform-version/src/version/drive_abci_versions.rs index b4eca9d9c14..a43f1100a43 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions.rs @@ -202,6 +202,7 @@ pub struct DriveAbciCoreChainLockMethodVersions { pub verify_chain_lock: FeatureVersion, pub verify_chain_lock_locally: FeatureVersion, pub verify_chain_lock_through_core: FeatureVersion, + pub make_sure_core_is_synced_to_height: FeatureVersion, } #[derive(Clone, Debug, Default)] From 7dca29355fe48152afe50a61a987dfcd49ebe315 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 23 Dec 2023 07:52:23 +0700 Subject: [PATCH 07/51] more fixes --- packages/rs-drive-abci/src/config.rs | 29 +++++++++++++++++-- .../platform_events/core_chain_lock/mod.rs | 1 - .../verify_chain_lock/v0/mod.rs | 1 + .../verify_chain_lock_locally/mod.rs | 1 + .../verify_chain_lock_locally/v0/mod.rs | 11 ++++--- .../src/version/mocks/v2_test.rs | 1 + .../src/version/mocks/v3_test.rs | 1 + .../rs-platform-version/src/version/v1.rs | 1 + 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 7b493203085..edaa0cfef0c 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -198,6 +198,11 @@ pub struct PlatformConfig { /// The default quorum size pub quorum_size: u16, + /// The window for chain locks + /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. + /// On Testnet Chain Locks are signed using 50_60: One quorum in every 24 blocks and activeQuorumCount is 24. + pub chain_lock_quorum_window: u32, + // todo: this should probably be coming from Tenderdash config /// Approximately how often are blocks produced pub block_spacing_ms: u64, @@ -310,12 +315,30 @@ impl Default for ExecutionConfig { } } -impl Default for PlatformConfig { - fn default() -> Self { +impl PlatformConfig { + pub fn default_testnet() -> Self { + Self { + validator_set_quorum_type: "llmq_25_67".to_string(), + chain_lock_quorum_type: "llmq_50_60".to_string(), + quorum_size: 25, + chain_lock_quorum_window: 24, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + testing_configs: PlatformTestConfig::default(), + initial_protocol_version: 1, + } + } + + pub fn default_mainnet() -> Self { Self { validator_set_quorum_type: "llmq_100_67".to_string(), - chain_lock_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_400_60".to_string(), quorum_size: 100, + chain_lock_quorum_window: 288, block_spacing_ms: 5000, drive: Default::default(), abci: Default::default(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index 2e09e016c91..edb777bab1a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -3,4 +3,3 @@ mod verify_chain_lock; mod verify_chain_lock_locally; mod verify_chain_lock_through_core; mod make_sure_core_is_synced_to_height; -mod make_sure_core_is_synced_for_state_transitions; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index c3c1f655227..e898c377c86 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -1,6 +1,7 @@ use crate::error::Error; use dpp::dashcore::ChainLock; use dpp::version::PlatformVersion; +use crate::config::PlatformConfig; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs index 0c9e41ae16c..4ca5d0a09c1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -10,6 +10,7 @@ use crate::rpc::core::CoreRPCLike; use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; +use crate::config::PlatformConfig; impl Platform where diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index f65d109a8e0..7889e38dce1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -12,9 +12,12 @@ use crate::rpc::core::CoreRPCLike; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; +use crate::config::PlatformConfig; const CHAIN_LOCK_REQUEST_ID_PREFIX: &str = "clsig"; +const SIGN_OFFSET : u32 = 8; + impl Platform where C: CoreRPCLike, @@ -33,7 +36,7 @@ where // we attempt to verify the chain lock locally let chain_lock_height = chain_lock.block_height; - let window_width = 578; + let window_width = self.config.chain_lock_quorum_window; // The last block in the window where the quorums would be the same let last_block_in_window = platform_state.last_committed_core_height() @@ -41,7 +44,7 @@ where + window_width - 1; - let verification_height = chain_lock.block_height - 8; + let verification_height = chain_lock.block_height - SIGN_OFFSET; if verification_height > last_block_in_window { return Ok(None); // the chain lock is too far in the future or the past to verify locally @@ -72,7 +75,7 @@ where .expect("expected to encode the prefix"); engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); - engine.input(chain_lock.block_height.to_be_bytes().as_slice()); + engine.input(chain_lock.block_height.to_le_bytes().as_slice()); let request_id = QuorumSigningRequestId::from_engine(engine); @@ -95,7 +98,7 @@ where engine.input(&[self.config.chain_lock_quorum_type() as u8]); engine.input(quorum_hash.as_byte_array()); - engine.input(chain_lock.block_hash.as_byte_array()); + engine.input(request_id.as_byte_array()); engine.input(chain_lock.block_hash.as_byte_array()); let message_digest = sha256d::Hash::from_engine(engine); diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 92bb19a79ba..6fe34d7e287 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -504,6 +504,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_height: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 76b454c2eaa..8e266ee5e3a 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -504,6 +504,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_height: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index b6cd61a0eea..dbded56416a 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -501,6 +501,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, + make_sure_core_is_synced_to_height: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, From 93d03ae849fd888cf83f05bfa29e1e51da613d3e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 23 Dec 2023 08:01:04 +0700 Subject: [PATCH 08/51] more fixes --- packages/rs-drive-abci/src/platform_types/platform/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rs-drive-abci/src/platform_types/platform/mod.rs b/packages/rs-drive-abci/src/platform_types/platform/mod.rs index c1519be9226..a1210bde943 100644 --- a/packages/rs-drive-abci/src/platform_types/platform/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform/mod.rs @@ -105,7 +105,7 @@ impl Platform { path: P, config: Option, ) -> Result, Error> { - let config = config.unwrap_or_default(); + let config = config.unwrap_or(PlatformConfig::default_testnet()); let core_rpc = DefaultCoreRPC::open( config.core.rpc.url().as_str(), config.core.rpc.username.clone(), @@ -179,7 +179,7 @@ impl Platform { where C: CoreRPCLike, { - let config = config.unwrap_or_default(); + let config = config.unwrap_or(PlatformConfig::default_testnet()); // TODO: Replace with version from the disk if present or latest? let platform_version = PlatformVersion::latest(); From 757e8780dc02897063a9dcdb00184c3e28668b89 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 28 Dec 2023 07:29:43 +0700 Subject: [PATCH 09/51] more work on verifying chain locks --- Cargo.lock | 259 +++++++++--------- .../rs-drive-abci/src/abci/handler/mod.rs | 4 +- .../engine/run_block_proposal/mod.rs | 3 + .../engine/run_block_proposal/v0/mod.rs | 31 ++- .../mod.rs | 14 +- .../v0/mod.rs | 11 +- .../platform_events/core_chain_lock/mod.rs | 2 +- .../core_chain_lock/verify_chain_lock/mod.rs | 5 +- .../verify_chain_lock/v0/mod.rs | 7 +- .../verify_chain_lock_through_core/mod.rs | 3 +- .../verify_chain_lock_through_core/v0/mod.rs | 12 +- .../initial_core_height/v0/mod.rs | 2 +- packages/rs-drive-abci/src/rpc/core.rs | 34 +-- .../src/version/drive_abci_versions.rs | 2 +- .../src/version/mocks/v2_test.rs | 2 +- .../src/version/mocks/v3_test.rs | 2 +- .../rs-platform-version/src/version/v1.rs | 2 +- 17 files changed, 200 insertions(+), 195 deletions(-) rename packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/{make_sure_core_is_synced_to_height => make_sure_core_is_synced_to_chain_lock}/mod.rs (69%) rename packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/{make_sure_core_is_synced_to_height => make_sure_core_is_synced_to_chain_lock}/v0/mod.rs (64%) diff --git a/Cargo.lock b/Cargo.lock index e0c8652e9d5..64017d58dbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" [[package]] name = "arrayref" @@ -179,18 +179,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -359,7 +359,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.41", + "syn 2.0.43", "which", ] @@ -462,9 +462,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9897ef0f1bd2362169de6d7e436ea2237dc1085d7d1e4db75f4be34d86f309d1" +checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" dependencies = [ "borsh-derive", "cfg_aliases", @@ -472,15 +472,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478b41ff04256c5c8330f3dfdaaae2a5cc976a8e75088bafa4625b0d0208de8c" +checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" dependencies = [ "once_cell", "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", "syn_derive", ] @@ -719,7 +719,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -817,7 +817,7 @@ dependencies = [ "clap 2.34.0", "criterion-plot", "csv", - "itertools", + "itertools 0.10.5", "lazy_static", "num-traits", "oorandom", @@ -839,14 +839,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" dependencies = [ "cfg-if", "crossbeam-utils", @@ -865,21 +865,20 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" dependencies = [ "cfg-if", ] @@ -940,7 +939,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -964,7 +963,7 @@ dependencies = [ "dapi-grpc", "heck", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -988,7 +987,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -999,7 +998,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -1026,7 +1025,7 @@ source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e7625 [[package]] name = "dashcore-rpc" version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#016e3af953fe92e0e58a8fe2b3958334e318b6c0" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#d62d3628f83efa7fba00d3c3c9e21ed87d4381ab" dependencies = [ "dashcore-private", "dashcore-rpc-json", @@ -1041,7 +1040,7 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#016e3af953fe92e0e58a8fe2b3958334e318b6c0" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#d62d3628f83efa7fba00d3c3c9e21ed87d4381ab" dependencies = [ "bincode 2.0.0-rc.3", "dashcore", @@ -1194,7 +1193,7 @@ dependencies = [ "hex", "indexmap 2.1.0", "integer-encoding 4.0.0", - "itertools", + "itertools 0.10.5", "json-patch", "jsonptr", "jsonschema", @@ -1243,7 +1242,7 @@ dependencies = [ "indexmap 1.9.3", "integer-encoding 4.0.0", "intmap", - "itertools", + "itertools 0.10.5", "moka", "nohash-hasher", "platform-version", @@ -1280,7 +1279,7 @@ dependencies = [ "hex", "indexmap 1.9.3", "integer-encoding 4.0.0", - "itertools", + "itertools 0.10.5", "lazy_static", "metrics", "metrics-exporter-prometheus", @@ -1395,7 +1394,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -1614,9 +1613,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1629,9 +1628,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1639,15 +1638,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1656,9 +1655,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -1677,32 +1676,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1766,7 +1765,7 @@ dependencies = [ "indexmap 1.9.3", "integer-encoding 3.0.4", "intmap", - "itertools", + "itertools 0.10.5", "nohash-hasher", "serde", "tempfile", @@ -1837,7 +1836,7 @@ version = "1.0.0-rc.2" source = "git+https://github.com/dashpay/grovedb?rev=b40dd1a35f852c81caeda2d3c2910c40fae3a67f#b40dd1a35f852c81caeda2d3c2910c40fae3a67f" dependencies = [ "hex", - "itertools", + "itertools 0.10.5", ] [[package]] @@ -1976,9 +1975,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1991,7 +1990,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -2147,6 +2146,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -2232,7 +2240,7 @@ source = "git+https://github.com/fominok/jsonschema-rs?branch=feat-unevaluated-p dependencies = [ "ahash 0.7.7", "anyhow", - "base64 0.13.1", + "base64 0.21.5", "bytecount", "fancy-regex", "fraction", @@ -2265,9 +2273,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "lhash" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6df04c84bd3f83849dd23c51be4cbb22a02d80ebdea22741558fe30127d837ae" +checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" [[package]] name = "libc" @@ -2352,9 +2360,9 @@ dependencies = [ [[package]] name = "mach2" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" dependencies = [ "libc", ] @@ -2388,15 +2396,6 @@ version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "metrics" version = "0.21.1" @@ -2428,13 +2427,13 @@ dependencies = [ [[package]] name = "metrics-macros" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" +checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -2623,7 +2622,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -2701,9 +2700,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -2806,7 +2805,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -2833,9 +2832,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "platform-serialization" @@ -2851,7 +2850,7 @@ version = "0.25.20" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", "virtue 0.0.14", ] @@ -2881,7 +2880,7 @@ name = "platform-value-convertible" version = "0.25.20" dependencies = [ "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -2897,7 +2896,7 @@ version = "0.25.20" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -2976,7 +2975,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -3025,7 +3024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -3074,9 +3073,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -3109,7 +3108,7 @@ checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", - "itertools", + "itertools 0.10.5", "lazy_static", "log", "multimap", @@ -3131,7 +3130,7 @@ checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ "bytes", "heck", - "itertools", + "itertools 0.11.0", "log", "multimap", "once_cell", @@ -3140,7 +3139,7 @@ dependencies = [ "prost 0.12.3", "prost-types 0.12.3", "regex", - "syn 2.0.41", + "syn 2.0.43", "tempfile", "which", ] @@ -3152,7 +3151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -3165,10 +3164,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -3636,11 +3635,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3748,9 +3747,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.12" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +checksum = "8bb1879ea93538b78549031e2d54da3e901fd7e75f2e4dc758d760937b123d10" dependencies = [ "serde", ] @@ -3773,7 +3772,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -3796,7 +3795,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -3839,7 +3838,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -3851,7 +3850,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -4066,9 +4065,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2", "quote", @@ -4084,7 +4083,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -4154,7 +4153,7 @@ dependencies = [ [[package]] name = "tenderdash-abci" version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +source = "git+https://github.com/dashpay/rs-tenderdash-abci#6ebfaa31052f7ad538d6589323e5daf7e5e55999" dependencies = [ "bytes", "futures", @@ -4193,7 +4192,7 @@ dependencies = [ [[package]] name = "tenderdash-proto" version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +source = "git+https://github.com/dashpay/rs-tenderdash-abci#6ebfaa31052f7ad538d6589323e5daf7e5e55999" dependencies = [ "bytes", "chrono", @@ -4225,7 +4224,7 @@ dependencies = [ [[package]] name = "tenderdash-proto-compiler" version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#b4df6543efb0457a477db30153131495da1b8bbb" +source = "git+https://github.com/dashpay/rs-tenderdash-abci#6ebfaa31052f7ad538d6589323e5daf7e5e55999" dependencies = [ "fs_extra", "prost-build 0.12.3", @@ -4284,22 +4283,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -4314,9 +4313,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -4334,9 +4333,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -4368,9 +4367,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -4403,7 +4402,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -4578,7 +4577,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] @@ -4857,7 +4856,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", "wasm-bindgen-shared", ] @@ -4891,7 +4890,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4910,7 +4909,7 @@ dependencies = [ "async-trait", "dpp", "hex", - "itertools", + "itertools 0.10.5", "js-sys", "log", "num_enum", @@ -5137,9 +5136,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.28" +version = "0.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" +checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" dependencies = [ "memchr", ] @@ -5172,22 +5171,22 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.31" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.43", ] [[package]] diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 1f2c5726928..d5aa7ff5d64 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -245,7 +245,7 @@ where // Running the proposal executes all the state transitions for the block let run_result = self .platform - .run_block_proposal(block_proposal, transaction)?; + .run_block_proposal(block_proposal, true, transaction)?; if !run_result.is_valid() { // This is a system error, because we are proposing @@ -482,7 +482,7 @@ where // Running the proposal executes all the state transitions for the block let run_result = self .platform - .run_block_proposal((&request).try_into()?, transaction)?; + .run_block_proposal((&request).try_into()?, false, transaction)?; if !run_result.is_valid() { // This was an error running this proposal, tell tenderdash that the block isn't valid diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs index 01b951d49e1..aee3c50528a 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs @@ -23,6 +23,7 @@ where /// # Arguments /// /// * `block_proposal` - The block proposal to be processed. + /// * `known_from_us` - Do we know that we made this block proposal? /// * `transaction` - The transaction associated with the block proposal. /// /// # Returns @@ -40,6 +41,7 @@ where pub fn run_block_proposal( &self, block_proposal: block_proposal::v0::BlockProposal, + known_from_us: bool, transaction: &Transaction, ) -> Result, Error> { @@ -57,6 +59,7 @@ where { 0 => self.run_block_proposal_v0( block_proposal, + known_from_us, epoch_info.into(), transaction, platform_version, diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index cf906b7eee1..63f8046a007 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -46,6 +46,7 @@ where /// # Arguments /// /// * `block_proposal` - The block proposal to be processed. + /// * `known_from_us` - Do we know that we made this block proposal?. /// * `transaction` - The transaction associated with the block proposal. /// /// # Returns @@ -63,6 +64,7 @@ where pub(super) fn run_block_proposal_v0( &self, block_proposal: block_proposal::v0::BlockProposal, + known_from_us: bool, epoch_info: EpochInfo, transaction: &Transaction, platform_version: &PlatformVersion, @@ -125,19 +127,22 @@ where // If there is a core chain lock update, we should start by verifying it if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { - let valid = self.verify_chain_lock( - &block_platform_state, - core_chain_lock_update, - platform_version, - )?; - if !valid { - return Ok(ValidationResult::new_with_error( - AbciError::InvalidChainLock(format!( - "received a chain lock for height {} that is invalid {:?}", - block_info.height, core_chain_lock_update, - )) - .into(), - )); + if !known_from_us { + let valid = self.verify_chain_lock( + &block_platform_state, + core_chain_lock_update, + true, // if it's not known from us, then we should try submitting it + platform_version, + )?; + if !valid { + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs similarity index 69% rename from packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs rename to packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs index 25fb6baa901..6b933355434 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -14,14 +14,16 @@ impl Platform { /// The point of this call is to make sure core is synced. /// Before this call we had previously validated that the chain lock is valid. - /// The core height passed here is the core height that we need to be able to validate all asset lock proofs. + /// Right now the core height should be the same as the chain lock height. + /// + /// Todo: In the future: The core height passed here is the core height that we need to be able to validate all + /// asset lock proofs. /// It should be chosen by taking the highest height of all state transitions that require core. /// State transitions that require core are: /// *Identity Create State transition /// *Identity Top up State transition - pub fn make_sure_core_is_synced_to_height( + pub fn make_sure_core_is_synced_to_chain_lock( &self, - core_height: u32, chain_lock: &ChainLock, platform_version: &PlatformVersion, ) -> Result<(), Error> { @@ -29,11 +31,11 @@ impl Platform .drive_abci .methods .core_chain_lock - .make_sure_core_is_synced_to_height + .make_sure_core_is_synced_to_chain_lock { - 0 => Ok(self.make_sure_core_is_synced_to_height_v0(core_height, chain_lock, platform_version)), + 0 => self.make_sure_core_is_synced_to_chain_lock_v0(chain_lock), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { - method: "make_sure_core_is_synced_to_height".to_string(), + method: "make_sure_core_is_synced_to_chain_lock".to_string(), known_versions: vec![0], received: version, })), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs similarity index 64% rename from packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs rename to packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs index 50d6883eddb..d558b0d17e8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_height/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -10,17 +10,16 @@ impl Platform { /// The point of this call is to make sure core is synced. /// Before this call we had previously validated that the chain lock is valid. - pub(super) fn make_sure_core_is_synced_to_height_v0( + pub(super) fn make_sure_core_is_synced_to_chain_lock_v0( &self, chain_lock: &ChainLock, - platform_version: &PlatformVersion, ) -> Result<(), Error> { // We need to make sure core is synced to the core height we see as valid for the state transitions - // First we must ask core for the locked core height + match self.core_rpc.submit_chain_lock(chain_lock) { + Ok(_) => {} + Err(_) => {} + } - let best_core_chain_lock = self.core_rpc.get_best_chain_lock()?; - - // If the best core chain lock height is higher than that current chain lock } } \ No newline at end of file diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index edb777bab1a..0bbc92b19e2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -2,4 +2,4 @@ mod choose_quorum; mod verify_chain_lock; mod verify_chain_lock_locally; mod verify_chain_lock_through_core; -mod make_sure_core_is_synced_to_height; +mod make_sure_core_is_synced_to_chain_lock; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index 7926b8c58af..dc41e259373 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -16,10 +16,13 @@ where C: CoreRPCLike, { /// Verify the chain lock + /// If submit is true, we try to submit the chain lock if it is considered valid or we can not check to see if it is + /// valid on platform. pub fn verify_chain_lock( &self, platform_state: &PlatformState, chain_lock: &ChainLock, + make_sure_core_is_synced: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -28,7 +31,7 @@ where .core_chain_lock .verify_chain_lock { - 0 => self.verify_chain_lock_v0(platform_state, chain_lock, platform_version), + 0 => self.verify_chain_lock_v0(platform_state, chain_lock, make_sure_core_is_synced, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index e898c377c86..41acf43c712 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -17,16 +17,19 @@ where &self, platform_state: &PlatformState, chain_lock: &ChainLock, + make_sure_core_is_synced: bool, platform_version: &PlatformVersion, ) -> Result { // first we try to verify the chain lock locally if let Some(valid) = self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? { + if valid && make_sure_core_is_synced { + self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version)?; + } Ok(valid) } else { - // if we were not able to validate it locally then we should go to core - self.verify_chain_lock_through_core(chain_lock, platform_version) + self.verify_chain_lock_through_core(chain_lock, make_sure_core_is_synced, platform_version) } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs index 33c0227b013..972d85b7045 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -18,6 +18,7 @@ where pub fn verify_chain_lock_through_core( &self, chain_lock: &ChainLock, + submit: bool, platform_version: &PlatformVersion, ) -> Result { match platform_version @@ -26,7 +27,7 @@ where .core_chain_lock .verify_chain_lock_through_core { - 0 => self.verify_chain_lock_through_core_v0(chain_lock), + 0 => self.verify_chain_lock_through_core_v0(chain_lock, submit), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock_through_core".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs index e6f35c64a6d..96a44240c14 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -10,11 +10,11 @@ where C: CoreRPCLike, { /// Verify the chain lock through core v0 - pub fn verify_chain_lock_through_core_v0(&self, chain_lock: &ChainLock) -> Result { - // Should we have a max height here? - - let valid = self.core_rpc.verify_chain_lock(chain_lock, None)?; - - Ok(valid) + pub fn verify_chain_lock_through_core_v0(&self, chain_lock: &ChainLock, submit: bool) -> Result { + if submit { + Ok(self.core_rpc.submit_chain_lock(chain_lock)?) + } else { + Ok(self.core_rpc.verify_chain_lock(chain_lock)?) + } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs index 3df1edb88d5..ab50a9e6de5 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/initialization/initial_core_height/v0/mod.rs @@ -44,7 +44,7 @@ where let v20_fork = fork_info.height.unwrap(); if let Some(requested) = requested { - let best = self.core_rpc.get_best_chain_lock()?.core_block_height; + let best = self.core_rpc.get_best_chain_lock()?.block_height; tracing::trace!( requested, diff --git a/packages/rs-drive-abci/src/rpc/core.rs b/packages/rs-drive-abci/src/rpc/core.rs index ab0c9b59a5f..ea1dddae9e2 100644 --- a/packages/rs-drive-abci/src/rpc/core.rs +++ b/packages/rs-drive-abci/src/rpc/core.rs @@ -24,8 +24,11 @@ pub trait CoreRPCLike { /// Get block hash by height fn get_block_hash(&self, height: CoreHeight) -> Result; - /// Get block hash by height - fn get_best_chain_lock(&self) -> Result; + /// Get the best chain lock + fn get_best_chain_lock(&self) -> Result; + + /// Submit a chain lock + fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result; /// Get transaction fn get_transaction(&self, tx_id: &Txid) -> Result; @@ -109,12 +112,9 @@ pub trait CoreRPCLike { ) -> Result; /// Verify a chain lock signature - /// If `max_height` is provided the chain lock will be verified - /// against quorums available at this height fn verify_chain_lock( &self, chain_lock: &ChainLock, - max_height: Option, ) -> Result; /// Returns masternode sync status @@ -202,19 +202,12 @@ impl CoreRPCLike for DefaultCoreRPC { retry!(self.inner.get_block_hash(height)) } - fn get_best_chain_lock(&self) -> Result { - //no need to retry on this one - let GetBestChainLockResult { - blockhash, - height, - signature, - known_block: _, - } = self.inner.get_best_chain_lock()?; - Ok(CoreChainLock { - core_block_height: height, - core_block_hash: blockhash.to_byte_array().to_vec(), - signature, - }) + fn get_best_chain_lock(&self) -> Result { + retry!(self.inner.get_best_chain_lock()) + } + + fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result { + retry!(self.inner.submit_chain_lock(chain_lock)) } fn get_transaction(&self, tx_id: &Txid) -> Result { @@ -300,19 +293,16 @@ impl CoreRPCLike for DefaultCoreRPC { } /// Verify a chain lock signature - /// If `max_height` is provided the chain lock will be verified - /// against quorums available at this height fn verify_chain_lock( &self, chain_lock: &ChainLock, - max_height: Option, ) -> Result { let block_hash = chain_lock.block_hash.to_string(); let signature = hex::encode(chain_lock.signature); retry!(self .inner - .get_verifychainlock(block_hash.as_str(), &signature, max_height)) + .get_verifychainlock(block_hash.as_str(), &signature, Some(chain_lock.block_height))) } /// Returns masternode sync status diff --git a/packages/rs-platform-version/src/version/drive_abci_versions.rs b/packages/rs-platform-version/src/version/drive_abci_versions.rs index a43f1100a43..111140cc06a 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions.rs @@ -202,7 +202,7 @@ pub struct DriveAbciCoreChainLockMethodVersions { pub verify_chain_lock: FeatureVersion, pub verify_chain_lock_locally: FeatureVersion, pub verify_chain_lock_through_core: FeatureVersion, - pub make_sure_core_is_synced_to_height: FeatureVersion, + pub make_sure_core_is_synced_to_chain_lock: FeatureVersion, } #[derive(Clone, Debug, Default)] diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 6fe34d7e287..eb8f9744266 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -504,7 +504,7 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, - make_sure_core_is_synced_to_height: 0, + make_sure_core_is_synced_to_chain_lock: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 8e266ee5e3a..961624a902b 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -504,7 +504,7 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, - make_sure_core_is_synced_to_height: 0, + make_sure_core_is_synced_to_chain_lock: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index dbded56416a..33d095dc8d6 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -501,7 +501,7 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, - make_sure_core_is_synced_to_height: 0, + make_sure_core_is_synced_to_chain_lock: 0, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, From 94cde2e13d4ecc15e108f1d302e93056769c6a5b Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Thu, 28 Dec 2023 15:08:52 +0200 Subject: [PATCH 10/51] compilation fixes --- packages/rs-drive-abci/src/abci/handler/mod.rs | 13 +++++++++---- packages/rs-drive-abci/src/config.rs | 2 ++ .../v0/mod.rs | 8 +++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index d5aa7ff5d64..aa13a03010e 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -52,6 +52,7 @@ use tenderdash_abci::proto::abci::{ RequestProcessProposal, RequestQuery, ResponseCheckTx, ResponseFinalizeBlock, ResponseInitChain, ResponsePrepareProposal, ResponseProcessProposal, ResponseQuery, TxRecord, }; +use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::proto::types::VoteExtensionType; use super::AbciError; @@ -181,7 +182,7 @@ where let core_chain_lock_update = match self.platform.core_rpc.get_best_chain_lock() { Ok(latest_chain_lock) => { - if request.core_chain_locked_height < latest_chain_lock.core_block_height { + if request.core_chain_locked_height < latest_chain_lock.block_height { Some(latest_chain_lock) } else { None @@ -217,10 +218,10 @@ where // todo: find a way to re-enable this without destroying CI tracing::debug!( "propose chain lock update to height {} at block {}", - core_chain_lock_update.core_block_height, + core_chain_lock_update.block_height, request.height ); - block_proposal.core_chain_locked_height = core_chain_lock_update.core_block_height; + block_proposal.core_chain_locked_height = core_chain_lock_update.block_height; } // Prepare transaction @@ -303,7 +304,11 @@ where tx_results, app_hash: app_hash.to_vec(), tx_records, - core_chain_lock_update, + core_chain_lock_update: Some(CoreChainLock { + core_block_hash: core_chain_lock_update.as_ref().unwrap().block_hash.to_byte_array().to_vec(), + core_block_height: core_chain_lock_update.as_ref().unwrap().block_height, + signature: core_chain_lock_update.as_ref().unwrap().signature.to_bytes().to_vec(), + }), validator_set_update, ..Default::default() }; diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index edaa0cfef0c..3fce56d69b1 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -315,6 +315,8 @@ impl Default for ExecutionConfig { } } + +#[allow(missing_docs)] impl PlatformConfig { pub fn default_testnet() -> Self { Self { diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs index d558b0d17e8..b42c18ef1d5 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -15,11 +15,9 @@ impl Platform chain_lock: &ChainLock, ) -> Result<(), Error> { // We need to make sure core is synced to the core height we see as valid for the state transitions + self.core_rpc.submit_chain_lock(chain_lock)?; - match self.core_rpc.submit_chain_lock(chain_lock) { - Ok(_) => {} - Err(_) => {} - } - + // If successful, proceed with further logic (if any), or just return Ok(()) + Ok(()) } } \ No newline at end of file From d113024c0f7a338097e9a8feac9a7d01861c45e1 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 6 Jan 2024 21:11:03 +0700 Subject: [PATCH 11/51] fixes --- Cargo.lock | 271 +++++++---------- packages/dapi-grpc/Cargo.toml | 2 +- packages/rs-drive-abci/.env.example | 4 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../rs-drive-abci/src/abci/handler/mod.rs | 20 +- packages/rs-drive-abci/src/config.rs | 7 +- .../engine/run_block_proposal/v0/mod.rs | 2 +- .../mod.rs | 12 +- .../v0/mod.rs | 10 +- .../platform_events/core_chain_lock/mod.rs | 2 +- .../core_chain_lock/verify_chain_lock/mod.rs | 7 +- .../verify_chain_lock/v0/mod.rs | 8 +- .../verify_chain_lock_locally/mod.rs | 2 +- .../verify_chain_lock_locally/v0/mod.rs | 4 +- .../verify_chain_lock_through_core/v0/mod.rs | 6 +- .../v0/mod.rs | 2 + .../v0/mod.rs | 2 + .../check_tx_verification/v0/mod.rs | 4 +- packages/rs-drive-abci/src/rpc/core.rs | 18 +- .../tests/strategy_tests/core_update_tests.rs | 26 +- .../tests/strategy_tests/failures.rs | 30 +- .../tests/strategy_tests/main.rs | 273 +++++++++--------- .../tests/strategy_tests/query.rs | 26 +- .../strategy_tests/upgrade_fork_tests.rs | 42 +-- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- 25 files changed, 385 insertions(+), 399 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1473cf92a95..678e861be41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "once_cell", @@ -115,9 +115,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.77" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arrayref" @@ -179,18 +179,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -353,13 +353,13 @@ dependencies = [ "lazycell", "log", "peeking_take_while", - "prettyplease 0.2.15", + "prettyplease 0.2.16", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.43", + "syn 2.0.48", "which", ] @@ -480,7 +480,7 @@ dependencies = [ "proc-macro-crate 2.0.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "syn_derive", ] @@ -570,9 +570,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -668,9 +668,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", @@ -690,9 +690,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" dependencies = [ "clap_builder", "clap_derive", @@ -700,9 +700,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" dependencies = [ "anstream", "anstyle", @@ -719,7 +719,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -790,9 +790,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -939,7 +939,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -951,7 +951,7 @@ dependencies = [ "prost 0.11.9", "serde", "serde_bytes", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-proto", "tonic", "tonic-build", ] @@ -963,7 +963,7 @@ dependencies = [ "dapi-grpc", "heck", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -987,7 +987,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -998,7 +998,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1106,9 +1106,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -1265,7 +1265,7 @@ dependencies = [ "bytes", "chrono", "ciborium", - "clap 4.4.11", + "clap 4.4.13", "dapi-grpc", "dashcore-rpc", "delegate", @@ -1298,7 +1298,7 @@ dependencies = [ "simple-signer", "strategy-tests", "tempfile", - "tenderdash-abci 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", + "tenderdash-abci", "thiserror", "tokio", "tokio-util", @@ -1319,7 +1319,7 @@ dependencies = [ "lazy_static", "serde", "serde_json", - "tenderdash-abci 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-abci", "thiserror", "tracing", ] @@ -1393,7 +1393,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1681,7 +1681,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -1878,7 +1878,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.7", ] [[package]] @@ -2010,9 +2010,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2118,13 +2118,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi 0.3.3", "rustix 0.38.28", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2284,12 +2284,12 @@ checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" dependencies = [ "cfg-if", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -2391,9 +2391,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "metrics" @@ -2401,7 +2401,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.7", "metrics-macros", "portable-atomic", ] @@ -2432,7 +2432,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2621,7 +2621,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2804,7 +2804,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2849,7 +2849,7 @@ version = "0.25.21" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "virtue 0.0.14", ] @@ -2879,7 +2879,7 @@ name = "platform-value-convertible" version = "0.25.21" dependencies = [ "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -2895,14 +2895,14 @@ version = "0.25.21" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "platforms" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "plotters" @@ -3018,12 +3018,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3072,9 +3072,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -3134,11 +3134,11 @@ dependencies = [ "multimap", "once_cell", "petgraph", - "prettyplease 0.2.15", + "prettyplease 0.2.16", "prost 0.12.3", "prost-types 0.12.3", "regex", - "syn 2.0.43", + "syn 2.0.48", "tempfile", "which", ] @@ -3166,7 +3166,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3236,9 +3236,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -3718,18 +3718,18 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] @@ -3746,9 +3746,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb1879ea93538b78549031e2d54da3e901fd7e75f2e4dc758d760937b123d10" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ "serde", ] @@ -3765,20 +3765,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "indexmap 2.1.0", "itoa", @@ -3788,13 +3788,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3837,7 +3837,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -3849,7 +3849,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4064,9 +4064,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -4082,7 +4082,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4117,42 +4117,21 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", "rustix 0.38.28", - "windows-sys 0.48.0", -] - -[[package]] -name = "tenderdash-abci" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" -dependencies = [ - "bytes", - "futures", - "hex", - "lhash", - "prost 0.12.3", - "semver", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", - "thiserror", - "tokio", - "tokio-util", - "tracing", - "tracing-subscriber", - "url", - "uuid 1.6.1", + "windows-sys 0.52.0", ] [[package]] name = "tenderdash-abci" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#6ebfaa31052f7ad538d6589323e5daf7e5e55999" +version = "0.14.0-dev.5" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.5#556f3a9b6724bdbe44acf8045cd87144a997bccb" dependencies = [ "bytes", "futures", @@ -4160,7 +4139,7 @@ dependencies = [ "lhash", "prost 0.12.3", "semver", - "tenderdash-proto 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", + "tenderdash-proto", "thiserror", "tokio", "tokio-util", @@ -4172,8 +4151,8 @@ dependencies = [ [[package]] name = "tenderdash-proto" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" +version = "0.14.0-dev.5" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.5#556f3a9b6724bdbe44acf8045cd87144a997bccb" dependencies = [ "bytes", "chrono", @@ -4184,46 +4163,14 @@ dependencies = [ "prost 0.12.3", "serde", "subtle-encoding", - "tenderdash-proto-compiler 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2)", + "tenderdash-proto-compiler", "time", ] -[[package]] -name = "tenderdash-proto" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#6ebfaa31052f7ad538d6589323e5daf7e5e55999" -dependencies = [ - "bytes", - "chrono", - "derive_more", - "flex-error", - "num-derive", - "num-traits", - "prost 0.12.3", - "serde", - "subtle-encoding", - "tenderdash-proto-compiler 0.14.0-dev.1 (git+https://github.com/dashpay/rs-tenderdash-abci)", - "time", -] - -[[package]] -name = "tenderdash-proto-compiler" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.2#6ebfaa31052f7ad538d6589323e5daf7e5e55999" -dependencies = [ - "fs_extra", - "prost-build 0.12.3", - "regex", - "tempfile", - "ureq", - "walkdir", - "zip", -] - [[package]] name = "tenderdash-proto-compiler" -version = "0.14.0-dev.1" -source = "git+https://github.com/dashpay/rs-tenderdash-abci#6ebfaa31052f7ad538d6589323e5daf7e5e55999" +version = "0.14.0-dev.5" +source = "git+https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.5#556f3a9b6724bdbe44acf8045cd87144a997bccb" dependencies = [ "fs_extra", "prost-build 0.12.3", @@ -4282,22 +4229,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.52" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.52" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4401,7 +4348,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4576,7 +4523,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] @@ -4855,7 +4802,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -4889,7 +4836,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4994,11 +4941,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -5135,9 +5082,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.31" +version = "0.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" +checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6" dependencies = [ "memchr", ] @@ -5185,7 +5132,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.48", ] [[package]] diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 7160550b714..ba1f2d4bca8 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -30,7 +30,7 @@ tonic = { version = "0.9.2", features = [ ], default-features = false } serde = { version = "1.0.171", optional = true, features = ["derive"] } serde_bytes = { version = "0.11.12", optional = true } -tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci" } +tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v0.14.0-dev.5" } dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" } platform-version = { path = "../rs-platform-version" } diff --git a/packages/rs-drive-abci/.env.example b/packages/rs-drive-abci/.env.example index 6bde9c76a6b..cefb0d406ad 100644 --- a/packages/rs-drive-abci/.env.example +++ b/packages/rs-drive-abci/.env.example @@ -34,7 +34,9 @@ NETWORK=testnet INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 # https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 -VALIDATOR_SET_LLMQ_TYPE=100 +VALIDATOR_SET_QUORUM_TYPE=100 +CHAIN_LOCK_QUORUM_TYPE=100 +CHAIN_LOCK_QUORUM_WINDOW=24 VALIDATOR_SET_QUORUM_ROTATION_BLOCK_COUNT=64 DKG_INTERVAL=24 diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index af6227b8831..aee530a8fa7 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -58,7 +58,7 @@ tracing-subscriber = { version = "0.3.16", default-features = false, features = "tracing-log", ], optional = false } atty = { version = "0.2.14", optional = false } -tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v0.14.0-dev.2" } +tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v0.14.0-dev.5" } lazy_static = "1.4.0" itertools = { version = "0.10.5" } file-rotate = { version = "0.7.3" } diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index f0920a8683b..aac4eecd736 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -321,9 +321,19 @@ where app_hash: app_hash.to_vec(), tx_records, core_chain_lock_update: Some(CoreChainLock { - core_block_hash: core_chain_lock_update.as_ref().unwrap().block_hash.to_byte_array().to_vec(), + core_block_hash: core_chain_lock_update + .as_ref() + .unwrap() + .block_hash + .to_byte_array() + .to_vec(), core_block_height: core_chain_lock_update.as_ref().unwrap().block_height, - signature: core_chain_lock_update.as_ref().unwrap().signature.to_bytes().to_vec(), + signature: core_chain_lock_update + .as_ref() + .unwrap() + .signature + .to_bytes() + .to_vec(), }), validator_set_update, // TODO: implement consensus param updates @@ -503,9 +513,9 @@ where let transaction = transaction_guard.as_ref().unwrap(); // Running the proposal executes all the state transitions for the block - let run_result = self - .platform - .run_block_proposal((&request).try_into()?, false, transaction)?; + let run_result = + self.platform + .run_block_proposal((&request).try_into()?, false, transaction)?; if !run_result.is_valid() { // This was an error running this proposal, tell tenderdash that the block isn't valid diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 3fce56d69b1..68906db3e21 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -315,6 +315,11 @@ impl Default for ExecutionConfig { } } +impl Default for PlatformConfig { + fn default() -> Self { + Self::default_testnet() + } +} #[allow(missing_docs)] impl PlatformConfig { @@ -391,7 +396,7 @@ mod tests { #[test] fn test_config_from_env() { // ABCI log configs are parsed manually, so they deserve separate handling - // Notat that STDOUT is also defined in .env.example, but env var should overwrite it. + // Note that STDOUT is also defined in .env.example, but env var should overwrite it. let vectors = &[ ("STDOUT", "pretty"), ("UPPERCASE", "json"), diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index b3d60b3a2b6..622ef42ef2d 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -140,7 +140,7 @@ where "received a chain lock for height {} that is invalid {:?}", block_info.height, core_chain_lock_update, )) - .into(), + .into(), )); } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs index 6b933355434..eb6d965e5e6 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -1,16 +1,16 @@ -use dashcore_rpc::dashcore::ChainLock; -use dpp::version::PlatformVersion; -use crate::error::Error; use crate::error::execution::ExecutionError; +use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; /// Version 0 pub mod v0; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// The point of this call is to make sure core is synced. /// Before this call we had previously validated that the chain lock is valid. @@ -41,4 +41,4 @@ impl Platform })), } } -} \ No newline at end of file +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs index b42c18ef1d5..604cdb8e970 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -1,12 +1,12 @@ -use dashcore_rpc::dashcore::ChainLock; -use dpp::version::PlatformVersion; use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; impl Platform - where - C: CoreRPCLike, +where + C: CoreRPCLike, { /// The point of this call is to make sure core is synced. /// Before this call we had previously validated that the chain lock is valid. @@ -20,4 +20,4 @@ impl Platform // If successful, proceed with further logic (if any), or just return Ok(()) Ok(()) } -} \ No newline at end of file +} diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs index 0bbc92b19e2..a44b48464e8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/mod.rs @@ -1,5 +1,5 @@ mod choose_quorum; +mod make_sure_core_is_synced_to_chain_lock; mod verify_chain_lock; mod verify_chain_lock_locally; mod verify_chain_lock_through_core; -mod make_sure_core_is_synced_to_chain_lock; diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index dc41e259373..f4fb60ad826 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -31,7 +31,12 @@ where .core_chain_lock .verify_chain_lock { - 0 => self.verify_chain_lock_v0(platform_state, chain_lock, make_sure_core_is_synced, platform_version), + 0 => self.verify_chain_lock_v0( + platform_state, + chain_lock, + make_sure_core_is_synced, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index 41acf43c712..dd60c5e21ad 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -1,7 +1,7 @@ +use crate::config::PlatformConfig; use crate::error::Error; use dpp::dashcore::ChainLock; use dpp::version::PlatformVersion; -use crate::config::PlatformConfig; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -29,7 +29,11 @@ where } Ok(valid) } else { - self.verify_chain_lock_through_core(chain_lock, make_sure_core_is_synced, platform_version) + self.verify_chain_lock_through_core( + chain_lock, + make_sure_core_is_synced, + platform_version, + ) } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs index 4ca5d0a09c1..ba5cb51581d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -8,9 +8,9 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use crate::config::PlatformConfig; use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; -use crate::config::PlatformConfig; impl Platform where diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 7889e38dce1..1c1523126c1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -9,14 +9,14 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use crate::config::PlatformConfig; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use dpp::version::PlatformVersion; -use crate::config::PlatformConfig; const CHAIN_LOCK_REQUEST_ID_PREFIX: &str = "clsig"; -const SIGN_OFFSET : u32 = 8; +const SIGN_OFFSET: u32 = 8; impl Platform where diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs index 96a44240c14..7baef2dc125 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -10,7 +10,11 @@ where C: CoreRPCLike, { /// Verify the chain lock through core v0 - pub fn verify_chain_lock_through_core_v0(&self, chain_lock: &ChainLock, submit: bool) -> Result { + pub fn verify_chain_lock_through_core_v0( + &self, + chain_lock: &ChainLock, + submit: bool, + ) -> Result { if submit { Ok(self.core_rpc.submit_chain_lock(chain_lock)?) } else { diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs index 139820ec9ac..5e17d00ffcc 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/pool_withdrawals_into_transactions_queue/v0/mod.rs @@ -209,6 +209,8 @@ mod tests { current_validator_set_quorum_hash: QuorumHash::all_zeros(), next_validator_set_quorum_hash: None, validator_sets: Default::default(), + chain_lock_validating_quorums: Default::default(), + previous_height_chain_lock_validating_quorums: None, full_masternode_list: Default::default(), hpmn_masternode_list: Default::default(), genesis_block_info: None, diff --git a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs index d0d503ada17..5a8c4e13e14 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/identity_credit_withdrawal/update_broadcasted_withdrawal_transaction_statuses/v0/mod.rs @@ -348,6 +348,8 @@ mod tests { current_validator_set_quorum_hash: QuorumHash::all_zeros(), next_validator_set_quorum_hash: None, validator_sets: Default::default(), + chain_lock_validating_quorums: Default::default(), + previous_height_chain_lock_validating_quorums: None, full_masternode_list: Default::default(), hpmn_masternode_list: Default::default(), genesis_block_info: None, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs index 20d35ea0b23..e3864c27c49 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/check_tx_verification/v0/mod.rs @@ -146,7 +146,7 @@ pub(super) fn state_transition_to_execution_event_for_check_tx_v0<'a, C: CoreRPC let execution_event = ExecutionEvent::create_from_state_transition_action( action, maybe_identity, - platform.state.epoch_ref(), + platform.state.last_committed_block_epoch_ref(), state_transition_execution_context, platform_version, )?; @@ -206,7 +206,7 @@ pub(super) fn state_transition_to_execution_event_for_check_tx_v0<'a, C: CoreRPC let execution_event = ExecutionEvent::create_from_state_transition_action( action, maybe_identity, - platform.state.epoch_ref(), + platform.state.last_committed_block_epoch_ref(), state_transition_execution_context, platform_version, )?; diff --git a/packages/rs-drive-abci/src/rpc/core.rs b/packages/rs-drive-abci/src/rpc/core.rs index ea1dddae9e2..f875d2f46b0 100644 --- a/packages/rs-drive-abci/src/rpc/core.rs +++ b/packages/rs-drive-abci/src/rpc/core.rs @@ -112,10 +112,7 @@ pub trait CoreRPCLike { ) -> Result; /// Verify a chain lock signature - fn verify_chain_lock( - &self, - chain_lock: &ChainLock, - ) -> Result; + fn verify_chain_lock(&self, chain_lock: &ChainLock) -> Result; /// Returns masternode sync status fn masternode_sync_status(&self) -> Result; @@ -293,16 +290,15 @@ impl CoreRPCLike for DefaultCoreRPC { } /// Verify a chain lock signature - fn verify_chain_lock( - &self, - chain_lock: &ChainLock, - ) -> Result { + fn verify_chain_lock(&self, chain_lock: &ChainLock) -> Result { let block_hash = chain_lock.block_hash.to_string(); let signature = hex::encode(chain_lock.signature); - retry!(self - .inner - .get_verifychainlock(block_hash.as_str(), &signature, Some(chain_lock.block_height))) + retry!(self.inner.get_verifychainlock( + block_hash.as_str(), + &signature, + Some(chain_lock.block_height) + )) } /// Returns masternode sync status diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index 223f9ee0f2b..b306d598f0f 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -1,5 +1,7 @@ #[cfg(test)] mod tests { + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; use tenderdash_abci::proto::types::CoreChainLock; use crate::execution::run_chain_for_strategy; @@ -79,10 +81,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 1, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 1, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); @@ -185,10 +187,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 1, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 1, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); @@ -280,10 +282,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 1, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 1, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 26, strategy, config, 13); diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index 6f55d48d657..ec570c4abee 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -11,6 +11,8 @@ mod tests { use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::document_type::random_document::{ DocumentFieldFillSize, DocumentFieldFillType, @@ -98,10 +100,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); @@ -186,15 +188,15 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - let core_block_height = if core_block_heights.len() == 1 { + let block_height = if core_block_heights.len() == 1 { *core_block_heights.first().unwrap() } else { core_block_heights.remove(0) }; - Ok(CoreChainLock { - core_block_height, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); run_chain_for_strategy(&mut platform, 1, strategy.clone(), config.clone(), 15); @@ -373,15 +375,15 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - let core_block_height = if core_block_heights.len() == 1 { + let block_height = if core_block_heights.len() == 1 { *core_block_heights.first().unwrap() } else { core_block_heights.remove(0) }; - Ok(CoreChainLock { - core_block_height, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); // On the first block we only have identities and contracts diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 0fd3a7efea2..b21763b2869 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -74,6 +74,7 @@ mod tests { DocumentAction, DocumentOp, IdentityUpdateOp, Operation, OperationType, }; + use dpp::dashcore::ChainLock; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::document_type::random_document::{ DocumentFieldFillSize, DocumentFieldFillType, @@ -163,10 +164,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); run_chain_for_strategy(&mut platform, 100, strategy, config, 15); @@ -219,10 +220,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); run_chain_for_strategy(&mut platform, 50, strategy, config, 13); @@ -278,10 +279,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -420,10 +421,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -553,10 +554,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15); @@ -623,10 +624,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); @@ -680,10 +681,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); @@ -745,10 +746,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); @@ -810,10 +811,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, .. } = @@ -900,10 +901,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, .. } = @@ -975,10 +976,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { abci_app, .. } = @@ -1045,10 +1046,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { @@ -1144,10 +1145,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15); @@ -1203,10 +1204,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 150, strategy, config, 15); @@ -1286,10 +1287,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15); @@ -1398,10 +1399,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); @@ -1505,10 +1506,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); run_chain_for_strategy(&mut platform, 100, strategy, config, 15); @@ -1590,10 +1591,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); @@ -1701,10 +1702,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); @@ -1813,10 +1814,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); @@ -1940,10 +1941,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); @@ -2071,10 +2072,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); @@ -2142,10 +2143,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); @@ -2226,10 +2227,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); @@ -2315,10 +2316,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); @@ -2411,10 +2412,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); @@ -2480,10 +2481,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -2632,20 +2633,20 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); platform_b .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -2759,20 +2760,20 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); platform_b .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -2889,10 +2890,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -3027,10 +3028,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 15, strategy, config, 15); @@ -3084,10 +3085,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index 1e8c4fe0aec..61ba9d35044 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -349,6 +349,8 @@ mod tests { use strategy_tests::Strategy; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::Application; @@ -424,10 +426,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); @@ -535,10 +537,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); @@ -647,10 +649,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); 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 8fe6259375f..c3619137577 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 @@ -1,6 +1,8 @@ #[cfg(test)] mod tests { use dpp::block::extended_block_info::v0::ExtendedBlockInfoV0Getters; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; use dpp::version::PlatformVersion; use drive::drive::config::DriveConfig; use tenderdash_abci::proto::types::CoreChainLock; @@ -85,10 +87,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { @@ -351,10 +353,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { @@ -616,10 +618,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); @@ -877,10 +879,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { @@ -1243,10 +1245,10 @@ mod tests { .core_rpc .expect_get_best_chain_lock() .returning(move || { - Ok(CoreChainLock { - core_block_height: 10, - core_block_hash: [1; 32].to_vec(), - signature: [2; 96].to_vec(), + Ok(ChainLock { + block_height: 10, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), }) }); let ChainExecutionOutcome { diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index fa889b441e8..048254f2fc8 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -20,7 +20,7 @@ drive = { path = "../rs-drive", default-features = false, features = [ "verify", ] } dpp = { path = "../rs-dpp" } -tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci" } +tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v0.14.0-dev.5" } # tenderdash-abci = { path = "../../../rs-tenderdash-abci/abci" } tracing = { version = "0.1.37" } serde = { version = "1.0.171", default-features = false, optional = true } From 35488b9bc95e17e0e978f68058e689b24819902d Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sun, 7 Jan 2024 02:23:34 +0700 Subject: [PATCH 12/51] more fixes --- .../rs-drive-abci/src/abci/handler/mod.rs | 18 ++---- packages/rs-drive-abci/src/config.rs | 2 +- .../tests/strategy_tests/core_update_tests.rs | 6 ++ .../tests/strategy_tests/failures.rs | 6 ++ .../tests/strategy_tests/main.rs | 64 +++++++++++++++++++ .../tests/strategy_tests/query.rs | 6 ++ .../strategy_tests/upgrade_fork_tests.rs | 10 +++ 7 files changed, 97 insertions(+), 15 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index aac4eecd736..91ecf6685ff 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -320,20 +320,10 @@ where tx_results, app_hash: app_hash.to_vec(), tx_records, - core_chain_lock_update: Some(CoreChainLock { - core_block_hash: core_chain_lock_update - .as_ref() - .unwrap() - .block_hash - .to_byte_array() - .to_vec(), - core_block_height: core_chain_lock_update.as_ref().unwrap().block_height, - signature: core_chain_lock_update - .as_ref() - .unwrap() - .signature - .to_bytes() - .to_vec(), + core_chain_lock_update: core_chain_lock_update.map(|chain_lock| CoreChainLock { + core_block_hash: chain_lock.block_hash.to_byte_array().to_vec(), + core_block_height: chain_lock.block_height, + signature: chain_lock.signature.to_bytes().to_vec(), }), validator_set_update, // TODO: implement consensus param updates diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 68906db3e21..3e383ec9f09 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -317,7 +317,7 @@ impl Default for ExecutionConfig { impl Default for PlatformConfig { fn default() -> Self { - Self::default_testnet() + Self::default_mainnet() } } diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index b306d598f0f..e00b51ffcea 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -64,6 +64,8 @@ mod tests { let config = PlatformConfig { quorum_size, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -170,6 +172,8 @@ mod tests { let config = PlatformConfig { quorum_size, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -265,6 +269,8 @@ mod tests { let config = PlatformConfig { quorum_size, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index ec570c4abee..afe453ff708 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -84,6 +84,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -169,6 +171,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -215,6 +219,8 @@ mod tests { // This is a common scenario we should see quite often let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { //we disable document triggers because we are using dpns and dpns needs a preorder use_document_triggers: false, diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index b21763b2869..519798bd183 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -147,6 +147,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -203,6 +205,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -259,6 +263,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -401,6 +407,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -538,6 +546,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -607,6 +617,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -664,6 +676,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -728,6 +742,8 @@ mod tests { let three_mins_in_ms = 1000 * 60 * 3; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -794,6 +810,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 10, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -884,6 +902,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 10, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -959,6 +979,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 10, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -1029,6 +1051,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 10, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -1129,6 +1153,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -1187,6 +1213,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -1271,6 +1299,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -1383,6 +1413,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -1490,6 +1522,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -1574,6 +1608,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -1685,6 +1721,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -1796,6 +1834,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -1923,6 +1963,8 @@ mod tests { let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -2054,6 +2096,8 @@ mod tests { let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -2127,6 +2171,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -2211,6 +2257,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -2300,6 +2348,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -2396,6 +2446,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -2456,6 +2508,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 3, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 1, @@ -2613,6 +2667,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 3, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 1, @@ -2741,6 +2797,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 3, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 1, @@ -2869,6 +2927,8 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { quorum_size: 3, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 1, @@ -3011,6 +3071,8 @@ mod tests { let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, @@ -3069,6 +3131,8 @@ mod tests { }; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index 61ba9d35044..b9d6d0f4dea 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -409,6 +409,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -520,6 +522,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, @@ -632,6 +636,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 100, 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 c3619137577..aae849c6ed2 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 @@ -65,6 +65,8 @@ mod tests { let twenty_minutes_in_ms = 1000 * 60 * 20; let mut config = PlatformConfig { quorum_size: 100, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 125, @@ -335,6 +337,8 @@ mod tests { let thirty_seconds_in_ms = 1000 * 30; let config = PlatformConfig { quorum_size: 30, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 30, @@ -596,6 +600,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { quorum_size: 40, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 80, @@ -857,6 +863,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let mut config = PlatformConfig { quorum_size: 50, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 50, @@ -1223,6 +1231,8 @@ mod tests { let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { quorum_size: 50, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 30, From 00726ff96e1a79552e387af89e6c8cfb86e13c0a Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 8 Jan 2024 17:42:11 +0700 Subject: [PATCH 13/51] more work on chain lock errors --- packages/rs-drive-abci/src/abci/error.rs | 4 ++ .../engine/run_block_proposal/v0/mod.rs | 69 +++++++++++++++++-- .../mod.rs | 2 +- .../v0/mod.rs | 7 +- .../core_chain_lock/verify_chain_lock/mod.rs | 3 +- .../verify_chain_lock/v0/mod.rs | 57 +++++++++++---- .../rs-drive-abci/src/platform_types/mod.rs | 3 + .../verify_chain_lock_result/mod.rs | 2 + .../verify_chain_lock_result/v0/mod.rs | 12 ++++ 9 files changed, 134 insertions(+), 25 deletions(-) create mode 100644 packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs create mode 100644 packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs diff --git a/packages/rs-drive-abci/src/abci/error.rs b/packages/rs-drive-abci/src/abci/error.rs index 54ffb5f7ba6..800ee6eaed0 100644 --- a/packages/rs-drive-abci/src/abci/error.rs +++ b/packages/rs-drive-abci/src/abci/error.rs @@ -49,6 +49,10 @@ pub enum AbciError { #[error("invalid chain lock: {0}")] InvalidChainLock(String), + /// The chain lock received was invalid + #[error("chain lock is for a block not known by core: {0}")] + ChainLockedBlockNotKnownByCore(String), + /// Error returned by Tenderdash-abci library #[error("tenderdash: {0}")] Tenderdash(#[from] tenderdash_abci::Error), diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 622ef42ef2d..68edcc7305c 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -31,6 +31,7 @@ use crate::platform_types::epoch_info::v0::{EpochInfoV0Getters, EpochInfoV0Metho use crate::platform_types::epoch_info::EpochInfo; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::v0::PlatformStateV0Methods; +use crate::platform_types::verify_chain_lock_result::v0::VerifyChainLockResult; use crate::rpc::core::CoreRPCLike; impl Platform @@ -128,21 +129,79 @@ where // If there is a core chain lock update, we should start by verifying it if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { if !known_from_us { - let valid = self.verify_chain_lock( + let verification_result = self.verify_chain_lock( &block_platform_state, core_chain_lock_update, true, // if it's not known from us, then we should try submitting it platform_version, - )?; - if !valid { + ); + + let VerifyChainLockResult { + chain_lock_signature_is_deserializable, + found_valid_locally, + submitted, + found_valid_by_core, + } = match verification_result { + Ok(verification_result) => verification_result, + Err(e) => { + // This will happen if the signature is not + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(e.to_string()).into(), + )); + } + }; + + if !chain_lock_signature_is_deserializable { return Ok(ValidationResult::new_with_error( AbciError::InvalidChainLock(format!( - "received a chain lock for height {} that is invalid {:?}", + "received a chain lock for height {} that has a signature that can not be deserialized {:?}", block_info.height, core_chain_lock_update, )) - .into(), + .into(), )); } + + if let Some(found_valid_locally) = found_valid_locally { + // This means we are able to check if the chain lock is valid + if !found_valid_locally { + // The signature was not valid + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + + if let Some(submission_accepted_by_core) = submitted { + // This means we are able to check if the chain lock is valid + if !submission_accepted_by_core { + // The submission was not accepted by core + return Ok(ValidationResult::new_with_error( + AbciError::ChainLockedBlockNotKnownByCore(format!( + "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } + + if let Some(found_valid_by_core) = found_valid_by_core { + // This means we asked core if the chain lock was valid + if !found_valid_by_core { + // Core said it wasn't valid + return Ok(ValidationResult::new_with_error( + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid based on a core request {:?}", + block_info.height, core_chain_lock_update, + )) + .into(), + )); + } + } } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs index eb6d965e5e6..9c34b261a65 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -26,7 +26,7 @@ where &self, chain_lock: &ChainLock, platform_version: &PlatformVersion, - ) -> Result<(), Error> { + ) -> Result { match platform_version .drive_abci .methods diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs index 604cdb8e970..89c8d02d7ae 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -13,11 +13,8 @@ where pub(super) fn make_sure_core_is_synced_to_chain_lock_v0( &self, chain_lock: &ChainLock, - ) -> Result<(), Error> { + ) -> Result { // We need to make sure core is synced to the core height we see as valid for the state transitions - self.core_rpc.submit_chain_lock(chain_lock)?; - - // If successful, proceed with further logic (if any), or just return Ok(()) - Ok(()) + Ok(self.core_rpc.submit_chain_lock(chain_lock)?) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index f4fb60ad826..c0ddb466229 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -9,6 +9,7 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use crate::platform_types::platform_state::PlatformState; +use crate::platform_types::verify_chain_lock_result::v0::VerifyChainLockResult; use dpp::version::PlatformVersion; impl Platform @@ -24,7 +25,7 @@ where chain_lock: &ChainLock, make_sure_core_is_synced: bool, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match platform_version .drive_abci .methods diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index dd60c5e21ad..b4291e2d045 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -1,5 +1,6 @@ use crate::config::PlatformConfig; use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::verify_chain_lock::VerifyChainLockResult; use dpp::dashcore::ChainLock; use dpp::version::PlatformVersion; @@ -19,21 +20,51 @@ where chain_lock: &ChainLock, make_sure_core_is_synced: bool, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { // first we try to verify the chain lock locally - if let Some(valid) = - self.verify_chain_lock_locally(platform_state, chain_lock, platform_version)? - { - if valid && make_sure_core_is_synced { - self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version)?; + match self.verify_chain_lock_locally(platform_state, chain_lock, platform_version) { + Ok(Some(valid)) => { + if valid && make_sure_core_is_synced { + //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result + let submission_result = + self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version)?; + + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + submitted: Some(submission_result), + found_valid_by_core: None, + }) + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + submitted: None, + found_valid_by_core: None, + }) + } + } + Ok(None) => { + let verified = self.verify_chain_lock_through_core( + chain_lock, + make_sure_core_is_synced, + platform_version, + )?; + + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + submitted: None, + found_valid_by_core: Some(verified), + }) } - Ok(valid) - } else { - self.verify_chain_lock_through_core( - chain_lock, - make_sure_core_is_synced, - platform_version, - ) + Err(Error::BLSError(_)) => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: false, + found_valid_locally: None, + submitted: None, + found_valid_by_core: None, + }), + Err(e) => Err(e), } } } diff --git a/packages/rs-drive-abci/src/platform_types/mod.rs b/packages/rs-drive-abci/src/platform_types/mod.rs index 3c9ea91fdee..7602529bab6 100644 --- a/packages/rs-drive-abci/src/platform_types/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/mod.rs @@ -58,3 +58,6 @@ pub mod validator; pub mod validator_set; /// Withdrawal types pub mod withdrawal; + +/// Verify chain lock result +pub mod verify_chain_lock_result; diff --git a/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs new file mode 100644 index 00000000000..d09310b584f --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/mod.rs @@ -0,0 +1,2 @@ +/// V0 +pub mod v0; diff --git a/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs new file mode 100644 index 00000000000..6e11fdd1483 --- /dev/null +++ b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs @@ -0,0 +1,12 @@ +/// A structure for returning the result of verification of a chain lock +pub struct VerifyChainLockResult { + /// If the chain lock signature represents a valid G2 BLS Element + pub(crate) chain_lock_signature_is_deserializable: bool, + /// If the chain lock was found to be valid based on platform state + pub(crate) found_valid_locally: Option, + /// If we were able to stable to submit the chain lock to core and it is valid there + pub(crate) submitted: Option, + /// If we were not able to validate based on platform state - ie the chain lock is too far in + /// the future + pub(crate) found_valid_by_core: Option, +} From a6d3c401d99a8d9f191badb5453c80b2ee1e25c4 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Wed, 10 Jan 2024 14:02:47 +0300 Subject: [PATCH 14/51] feat: configure chain lock quorum type in dashmate (#1660) --- Dockerfile | 2 +- .../configs/defaults/getBaseConfigFactory.js | 4 + .../configs/defaults/getLocalConfigFactory.js | 4 + .../defaults/getTestnetConfigFactory.js | 4 + .../configs/getConfigFileMigrationsFactory.js | 16 +++ packages/dashmate/docker-compose.yml | 10 +- .../dashmate/src/config/configJsonSchema.js | 18 ++- packages/rs-drive-abci/.env.local | 62 +++++++++ .../{.env.example => .env.mainnet} | 23 +--- packages/rs-drive-abci/.env.testnet | 62 +++++++++ packages/rs-drive-abci/src/config.rs | 71 ++++------ .../block_end/validator_set_update/v0/mod.rs | 5 +- .../data_contract_update/mod.rs | 4 +- .../tests/strategy_tests/core_update_tests.rs | 12 +- .../tests/strategy_tests/execution.rs | 4 +- .../tests/strategy_tests/failures.rs | 12 +- .../tests/strategy_tests/main.rs | 128 +++++++++--------- .../tests/strategy_tests/query.rs | 12 +- .../strategy_tests/upgrade_fork_tests.rs | 20 +-- scripts/configure_dotenv.sh | 2 +- 20 files changed, 308 insertions(+), 167 deletions(-) create mode 100644 packages/rs-drive-abci/.env.local rename packages/rs-drive-abci/{.env.example => .env.mainnet} (85%) create mode 100644 packages/rs-drive-abci/.env.testnet diff --git a/Dockerfile b/Dockerfile index 25ab93f4373..e7a2d5928db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -236,7 +236,7 @@ RUN mkdir -p /var/log/dash \ /var/lib/dash/rs-drive-abci/db COPY --from=build-drive-abci /artifacts/drive-abci /usr/bin/drive-abci -COPY --from=build-drive-abci /platform/packages/rs-drive-abci/.env.example /var/lib/dash/rs-drive-abci/.env +COPY --from=build-drive-abci /platform/packages/rs-drive-abci/.env.mainnet /var/lib/dash/rs-drive-abci/.env # Create a volume VOLUME /var/lib/dash/rs-drive-abci/db diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index 0f0d404023f..3ba88fc3872 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -165,6 +165,10 @@ export default function getBaseConfigFactory(homeDir) { validatorSet: { llmqType: 4, }, + chainLock: { + llmqType: 2, + dkgInterval: 288, + }, epochTime: 788400, }, tenderdash: { diff --git a/packages/dashmate/configs/defaults/getLocalConfigFactory.js b/packages/dashmate/configs/defaults/getLocalConfigFactory.js index 56b87efabc3..84253277c0b 100644 --- a/packages/dashmate/configs/defaults/getLocalConfigFactory.js +++ b/packages/dashmate/configs/defaults/getLocalConfigFactory.js @@ -68,6 +68,10 @@ export default function getLocalConfigFactory(getBaseConfig) { validatorSet: { llmqType: 106, }, + chainLock: { + llmqType: 100, + dkgInterval: 24, + }, }, }, }, diff --git a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js index df5e05056f0..927ec0a8b83 100644 --- a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js +++ b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js @@ -53,6 +53,10 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { validatorSet: { llmqType: 6, }, + chainLock: { + llmqType: 1, + dkgInterval: 24, + }, }, tenderdash: { p2p: { diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 205271a7234..935b80a43aa 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -406,6 +406,22 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) return configFile; }, + '1.0.0-dev.1': (configFile) => { + Object.entries(configFile.configs) + .forEach(([name, options]) => { + + let baseConfigName = name; + if (options.group !== null && defaultConfigs.has(options.group)) { + baseConfigName = options.group; + } else if (!defaultConfigs.has(baseConfigName)) { + baseConfigName = 'testnet'; + } + + options.platform.drive.abci.chainLock = defaultConfigs.get(baseConfigName).get('platform.drive.abci.chainLock'); + }); + + return configFile; + }, }; } diff --git a/packages/dashmate/docker-compose.yml b/packages/dashmate/docker-compose.yml index 8ecff50b5b5..a1a9e577b6c 100644 --- a/packages/dashmate/docker-compose.yml +++ b/packages/dashmate/docker-compose.yml @@ -47,14 +47,11 @@ services: volumes: - drive_abci_data:/var/lib/dash/rs-drive-abci/db environment: - - BLOCK_SPACING_MS=3000 # TODO: sync with tenderdash - CHAIN_ID=${PLATFORM_DRIVE_TENDERDASH_GENESIS_CHAIN_ID:-devnet} - CORE_JSON_RPC_USERNAME=${CORE_RPC_USER:?err} - CORE_JSON_RPC_PASSWORD=${CORE_RPC_PASSWORD:?err} - CORE_JSON_RPC_HOST=core - CORE_JSON_RPC_PORT=${CORE_RPC_PORT:?err} - - CORE_ZMQ_HOST=core - - CORE_ZMQ_PORT=29998 - DPNS_MASTER_PUBLIC_KEY=${PLATFORM_DPNS_MASTER_PUBLIC_KEY} - DPNS_SECOND_PUBLIC_KEY=${PLATFORM_DPNS_SECOND_PUBLIC_KEY} - DASHPAY_MASTER_PUBLIC_KEY=${PLATFORM_DASHPAY_MASTER_PUBLIC_KEY} @@ -66,10 +63,9 @@ services: - MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=${PLATFORM_MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY} - WITHDRAWALS_MASTER_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_MASTER_PUBLIC_KEY} - WITHDRAWALS_SECOND_PUBLIC_KEY=${PLATFORM_WITHDRAWALS_SECOND_PUBLIC_KEY} - - QUORUM_SIZE=5 # TODO: sync with Tenderdash - - QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err} - - NETWORK=${NETWORK:?err} - - TENDERDASH_P2P_PORT=${PLATFORM_DRIVE_TENDERDASH_P2P_PORT:?err} + - VALIDATOR_SET_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err} + - CHAIN_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_TYPE:?err} + - CHAIN_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_DKG_INTERVAL:?err} stop_grace_period: 30s env_file: # Logger settings diff --git a/packages/dashmate/src/config/configJsonSchema.js b/packages/dashmate/src/config/configJsonSchema.js index d60a43e2d9e..b614e1cc9b9 100644 --- a/packages/dashmate/src/config/configJsonSchema.js +++ b/packages/dashmate/src/config/configJsonSchema.js @@ -503,13 +503,29 @@ export default { additionalProperties: false, required: ['llmqType'], }, + chainLock: { + type: 'object', + properties: { + llmqType: { + type: 'number', + // https://github.com/dashpay/dashcore-lib/blob/843176fed9fc81feae43ccf319d99e2dd942fe1f/lib/constants/index.js#L50-L99 + enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107], + }, + dkgInterval: { + type: 'integer', + minimum: 0, + }, + }, + additionalProperties: false, + required: ['llmqType', 'dkgInterval'], + }, epochTime: { type: 'integer', minimum: 180, }, }, additionalProperties: false, - required: ['docker', 'logs', 'validatorSet', 'epochTime'], + required: ['docker', 'logs', 'validatorSet', 'chainLock', 'epochTime'], }, tenderdash: { type: 'object', diff --git a/packages/rs-drive-abci/.env.local b/packages/rs-drive-abci/.env.local new file mode 100644 index 00000000000..4c336aa003d --- /dev/null +++ b/packages/rs-drive-abci/.env.local @@ -0,0 +1,62 @@ +# ABCI host and port to listen +ABCI_BIND_ADDRESS="tcp://0.0.0.0:26658" +ABCI_PROMETHEUS_BIND_ADDRESS="http://0.0.0.0:29090" + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_JSON_RPC_HOST=127.0.0.1 +CORE_JSON_RPC_PORT=9998 +CORE_JSON_RPC_USERNAME=dashrpc +CORE_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_LLMQ_TYPE=llmq_test +VALIDATOR_SET_QUORUM_SIZE=3 +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_test +CHAIN_LOCK_QUORUM_WINDOW=24 + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 diff --git a/packages/rs-drive-abci/.env.example b/packages/rs-drive-abci/.env.mainnet similarity index 85% rename from packages/rs-drive-abci/.env.example rename to packages/rs-drive-abci/.env.mainnet index cefb0d406ad..a6733bc78b6 100644 --- a/packages/rs-drive-abci/.env.example +++ b/packages/rs-drive-abci/.env.mainnet @@ -10,9 +10,6 @@ ABCI_LOG_STDOUT_COLOR=true DB_PATH=/tmp/db -# GroveDB database file -GROVEDB_LATEST_FILE=${DB_PATH}/latest_state - # Cache size for Data Contracts DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 @@ -29,18 +26,15 @@ CORE_ZMQ_HOST=127.0.0.1 CORE_ZMQ_PORT=29998 CORE_ZMQ_CONNECTION_RETRIES=16 -NETWORK=testnet - INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 # https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 -VALIDATOR_SET_QUORUM_TYPE=100 -CHAIN_LOCK_QUORUM_TYPE=100 -CHAIN_LOCK_QUORUM_WINDOW=24 -VALIDATOR_SET_QUORUM_ROTATION_BLOCK_COUNT=64 +VALIDATOR_SET_LLMQ_TYPE=llmq_100_67 +VALIDATOR_SET_QUORUM_SIZE=100 +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 -DKG_INTERVAL=24 -MIN_QUORUM_VALID_MEMBERS=3 +CHAIN_LOCK_QUORUM_TYPE=llmq_400_60 +CHAIN_LOCK_QUORUM_WINDOW=288 # DPNS Contract @@ -67,10 +61,7 @@ MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 -TENDERDASH_P2P_PORT=26656 - EPOCH_TIME_LENGTH_S=788400 -QUORUM_SIZE=5 -QUORUM_TYPE=llmq_25_67 + CHAIN_ID=devnet -BLOCK_SPACING_MS=3000 +BLOCK_SPACING_MS=5000 diff --git a/packages/rs-drive-abci/.env.testnet b/packages/rs-drive-abci/.env.testnet new file mode 100644 index 00000000000..202a78efafb --- /dev/null +++ b/packages/rs-drive-abci/.env.testnet @@ -0,0 +1,62 @@ +# ABCI host and port to listen +ABCI_BIND_ADDRESS="tcp://0.0.0.0:26658" +ABCI_PROMETHEUS_BIND_ADDRESS="http://0.0.0.0:29090" + +# stderr logging for humans +ABCI_LOG_STDOUT_DESTINATION=stdout +ABCI_LOG_STDOUT_LEVEL=info +ABCI_LOG_STDOUT_FORMAT=pretty +ABCI_LOG_STDOUT_COLOR=true + +DB_PATH=/tmp/db + +# Cache size for Data Contracts +DATA_CONTRACTS_GLOBAL_CACHE_SIZE=500 +DATA_CONTRACTS_BLOCK_CACHE_SIZE=200 + +# DashCore JSON-RPC host, port and credentials +# Read more: https://dashcore.readme.io/docs/core-api-ref-remote-procedure-calls +CORE_JSON_RPC_HOST=127.0.0.1 +CORE_JSON_RPC_PORT=9998 +CORE_JSON_RPC_USERNAME=dashrpc +CORE_JSON_RPC_PASSWORD=password + +INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 + +# https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 +VALIDATOR_SET_LLMQ_TYPE=llmq_25_67 +VALIDATOR_SET_QUORUM_SIZE=25 +VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 + +CHAIN_LOCK_QUORUM_TYPE=llmq_50_60 +CHAIN_LOCK_QUORUM_WINDOW=24 + +# DPNS Contract + +DPNS_MASTER_PUBLIC_KEY=02649a81b760e8635dd3a4fad8911388ed09d7c1680558a890180d4edc8bcece7e +DPNS_SECOND_PUBLIC_KEY=03f5ea3ab4bf594c28997eb8f83873532275ac2edd36e586b137ed42d15d510948 + +# Dashpay Contract + +DASHPAY_MASTER_PUBLIC_KEY=022d6d70c9d24d03904713db17fb74c9201801ba0e3aed0f5d91e89df388e94aa6 +DASHPAY_SECOND_PUBLIC_KEY=028c0a26c87b2e7f1aebbbeace9e687d774e037f5b50a6905b5f6fa24495b502cd + +# Feature flags contract + +FEATURE_FLAGS_MASTER_PUBLIC_KEY=034ee04c509083ecd09e76fa53e0b5331b39120c19607cd04c4f167707dbb42302 +FEATURE_FLAGS_SECOND_PUBLIC_KEY=03c755ae1b79dbcc79020aad3ccdfcb142fc6e74f1afc220fca1e275a87aa12cf8 + +# Masternode reward shares contract + +MASTERNODE_REWARD_SHARES_MASTER_PUBLIC_KEY=02099cc210c7b6c7f566099046ddc92615342db326184940bf3811026ea328c85e +MASTERNODE_REWARD_SHARES_SECOND_PUBLIC_KEY=02bf55f97f189895da29824781053140ee66b2bf47760246504fbe502985096af5 + +# Withdrawals contract + +WITHDRAWALS_MASTER_PUBLIC_KEY=027057cdf58628635ef7b75e6b6c90dd996a16929cd68130e16b9328d429e5e03a +WITHDRAWALS_SECOND_PUBLIC_KEY=022084d827fea4823a69aa7c8d3e02fe780eaa0ef1e5e9841af395ba7e40465ab6 + +EPOCH_TIME_LENGTH_S=788400 + +CHAIN_ID=devnet +BLOCK_SPACING_MS=5000 diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 3e383ec9f09..0910e258374 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -76,41 +76,12 @@ impl Default for CoreRpcConfig { } /// Configuration for Dash Core related things -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize, Default)] #[serde(default)] pub struct CoreConfig { /// Core RPC config #[serde(flatten)] pub rpc: CoreRpcConfig, - - /// DKG interval - pub dkg_interval: String, // String due to https://github.com/softprops/envy/issues/26 - /// Minimum number of valid members to use the quorum - pub min_quorum_valid_members: String, // String due to https://github.com/softprops/envy/issues/26 -} - -impl CoreConfig { - /// return dkg_interval - pub fn dkg_interval(&self) -> u32 { - self.dkg_interval - .parse::() - .expect("DKG_INTERVAL is not an int") - } - /// Returns minimal number of quorum members - pub fn min_quorum_valid_members(&self) -> u32 { - self.min_quorum_valid_members - .parse::() - .expect("MIN_QUORUM_VALID_MEMBERS is not an int") - } -} -impl Default for CoreConfig { - fn default() -> Self { - Self { - dkg_interval: String::from("24"), - min_quorum_valid_members: String::from("3"), - rpc: Default::default(), - } - } } /// Configuration of the execution part of Dash Platform. @@ -128,10 +99,10 @@ pub struct ExecutionConfig { /// How often should quorums change? #[serde( - default = "ExecutionConfig::default_validator_set_quorum_rotation_block_count", + default = "ExecutionConfig::default_validator_set_rotation_block_count", deserialize_with = "from_str_or_number" )] - pub validator_set_quorum_rotation_block_count: u32, + pub validator_set_rotation_block_count: u32, /// How long in seconds should an epoch last /// It might last a lot longer if the chain is halted @@ -195,15 +166,16 @@ pub struct PlatformConfig { /// The quorum type used for verifying chain locks pub chain_lock_quorum_type: String, + // TODO: It's a test-only param /// The default quorum size - pub quorum_size: u16, + pub validator_set_quorum_size: u16, /// The window for chain locks /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. /// On Testnet Chain Locks are signed using 50_60: One quorum in every 24 blocks and activeQuorumCount is 24. pub chain_lock_quorum_window: u32, - // todo: this should probably be coming from Tenderdash config + // todo: this should probably be coming from Tenderdash config. It's a test only param /// Approximately how often are blocks produced pub block_spacing_ms: u64, @@ -229,7 +201,7 @@ impl ExecutionConfig { true } - fn default_validator_set_quorum_rotation_block_count() -> u32 { + fn default_validator_set_rotation_block_count() -> u32 { 15 } @@ -308,8 +280,8 @@ impl Default for ExecutionConfig { Self { use_document_triggers: ExecutionConfig::default_use_document_triggers(), verify_sum_trees: ExecutionConfig::default_verify_sum_trees(), - validator_set_quorum_rotation_block_count: - ExecutionConfig::default_validator_set_quorum_rotation_block_count(), + validator_set_rotation_block_count: + ExecutionConfig::default_validator_set_rotation_block_count(), epoch_time_length_s: ExecutionConfig::default_epoch_time_length_s(), } } @@ -323,11 +295,28 @@ impl Default for PlatformConfig { #[allow(missing_docs)] impl PlatformConfig { + pub fn default_local() -> Self { + Self { + validator_set_quorum_type: "llmq_test_platform".to_string(), + chain_lock_quorum_type: "llmq_test".to_string(), + validator_set_quorum_size: 3, + chain_lock_quorum_window: 24, + block_spacing_ms: 5000, + drive: Default::default(), + abci: Default::default(), + core: Default::default(), + execution: Default::default(), + db_path: PathBuf::from("/var/lib/dash-platform/data"), + testing_configs: PlatformTestConfig::default(), + initial_protocol_version: 1, + } + } + pub fn default_testnet() -> Self { Self { validator_set_quorum_type: "llmq_25_67".to_string(), chain_lock_quorum_type: "llmq_50_60".to_string(), - quorum_size: 25, + validator_set_quorum_size: 25, chain_lock_quorum_window: 24, block_spacing_ms: 5000, drive: Default::default(), @@ -344,7 +333,7 @@ impl PlatformConfig { Self { validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_400_60".to_string(), - quorum_size: 100, + validator_set_quorum_size: 100, chain_lock_quorum_window: 288, block_spacing_ms: 5000, drive: Default::default(), @@ -409,10 +398,10 @@ mod tests { env::set_var(format!("ABCI_LOG_{}_FORMAT", vector.0), vector.1); } - let envfile = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".env.example"); + let envfile = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".env.local"); dotenvy::from_path(envfile.as_path()).expect("cannot load .env file"); - assert_eq!("5", env::var("QUORUM_SIZE").unwrap()); + assert_eq!("/tmp/db", env::var("DB_PATH").unwrap()); let config = super::PlatformConfig::from_env().expect("expected config from env"); assert!(config.execution.verify_sum_trees); diff --git a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs index 3a1ead24fb3..27b5fc37147 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/block_end/validator_set_update/v0/mod.rs @@ -27,10 +27,7 @@ where let mut perform_rotation = false; if block_execution_context.block_state_info().height() - % self - .config - .execution - .validator_set_quorum_rotation_block_count as u64 + % self.config.execution.validator_set_rotation_block_count as u64 == 0 { tracing::debug!( diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs index 151eca048e8..cd571da9b82 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs @@ -147,10 +147,10 @@ mod tests { .data_contract_owned(); let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 300, diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index e00b51ffcea..f2480bdcec3 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -63,12 +63,12 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set_quorum_size: quorum_size, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -171,12 +171,12 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set_quorum_size: quorum_size, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -268,12 +268,12 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set_quorum_size: quorum_size, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index aee63d84097..e4b1a8b1701 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -46,7 +46,7 @@ pub(crate) fn run_chain_for_strategy( seed: u64, ) -> ChainExecutionOutcome { let quorum_count = strategy.quorum_count; // We assume 24 quorums - let quorum_size = config.quorum_size; + let quorum_size = config.validator_set_quorum_size; let mut rng = StdRng::seed_from_u64(seed); @@ -613,7 +613,7 @@ pub(crate) fn continue_chain_for_strategy( StrategyRandomness::SeedEntropy(seed) => StdRng::seed_from_u64(seed), StrategyRandomness::RNGEntropy(rng) => rng, }; - let quorum_size = config.quorum_size; + let quorum_size = config.validator_set_quorum_size; let first_block_time = start_time_ms; let mut current_identities = vec![]; let mut signer = strategy.strategy.signer.clone().unwrap_or_default(); diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index afe453ff708..9b35599f375 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -83,12 +83,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -170,12 +170,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -218,13 +218,13 @@ mod tests { // We use the dpns contract and we insert two documents both with the same "name" // This is a common scenario we should see quite often let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { //we disable document triggers because we are using dpns and dpns needs a preorder use_document_triggers: false, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 519798bd183..422f12db1ad 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -146,12 +146,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -204,12 +204,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -262,12 +262,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -406,12 +406,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..ExecutionConfig::default() }, block_spacing_ms: 3000, @@ -545,12 +545,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -616,12 +616,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -675,12 +675,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: hour_in_ms, @@ -741,12 +741,12 @@ mod tests { let hour_in_s = 60 * 60; let three_mins_in_ms = 1000 * 60 * 3; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, epoch_time_length_s: hour_in_s, ..Default::default() }, @@ -809,12 +809,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 300, @@ -901,12 +901,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 300, @@ -978,12 +978,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 300, @@ -1050,12 +1050,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 300, @@ -1152,12 +1152,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -1212,12 +1212,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: day_in_ms, @@ -1298,12 +1298,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -1412,12 +1412,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -1521,12 +1521,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -1607,12 +1607,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: day_in_ms, @@ -1720,12 +1720,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: day_in_ms, @@ -1833,12 +1833,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: day_in_ms, @@ -1962,12 +1962,12 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, epoch_time_length_s: 1576800, ..Default::default() }, @@ -2095,12 +2095,12 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, epoch_time_length_s: 1576800, ..Default::default() }, @@ -2170,12 +2170,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -2256,12 +2256,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -2347,12 +2347,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -2445,12 +2445,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -2507,12 +2507,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, + validator_set_rotation_block_count: 1, ..Default::default() }, block_spacing_ms: day_in_ms, @@ -2666,12 +2666,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, + validator_set_rotation_block_count: 1, epoch_time_length_s: 1576800, ..Default::default() }, @@ -2796,12 +2796,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, + validator_set_rotation_block_count: 1, ..Default::default() }, block_spacing_ms: day_in_ms, @@ -2926,12 +2926,12 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 1, + validator_set_rotation_block_count: 1, epoch_time_length_s: 1576800, ..Default::default() }, @@ -3070,12 +3070,12 @@ mod tests { }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, @@ -3130,12 +3130,12 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index b9d6d0f4dea..fd57d4d83b1 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -408,12 +408,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: hour_in_ms, @@ -521,12 +521,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: hour_in_ms, @@ -635,12 +635,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 100, + validator_set_rotation_block_count: 100, ..Default::default() }, block_spacing_ms: hour_in_ms, 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 aae849c6ed2..688a663a414 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 @@ -64,12 +64,12 @@ mod tests { }; let twenty_minutes_in_ms = 1000 * 60 * 20; let mut config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 125, + validator_set_rotation_block_count: 125, epoch_time_length_s: 1576800, ..Default::default() }, @@ -336,12 +336,12 @@ mod tests { let one_hour_in_s = 60 * 60; let thirty_seconds_in_ms = 1000 * 30; let config = PlatformConfig { - quorum_size: 30, + validator_set_quorum_size: 30, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 30, + validator_set_rotation_block_count: 30, epoch_time_length_s: one_hour_in_s, ..Default::default() }, @@ -599,12 +599,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 40, + validator_set_quorum_size: 40, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 80, + validator_set_rotation_block_count: 80, epoch_time_length_s: 1576800, ..Default::default() }, @@ -862,12 +862,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let mut config = PlatformConfig { - quorum_size: 50, + validator_set_quorum_size: 50, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 50, + validator_set_rotation_block_count: 50, epoch_time_length_s: 1576800, ..Default::default() }, @@ -1230,12 +1230,12 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 50, + validator_set_quorum_size: 50, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 30, + validator_set_rotation_block_count: 30, epoch_time_length_s: 1576800, ..Default::default() }, diff --git a/scripts/configure_dotenv.sh b/scripts/configure_dotenv.sh index 2074b73ca3b..f5f6fa4636b 100755 --- a/scripts/configure_dotenv.sh +++ b/scripts/configure_dotenv.sh @@ -50,7 +50,7 @@ NETWORK=regtest" >>"${SDK_ENV_FILE_PATH}" #EOF # DRIVE: -cp "${DRIVE_PATH}"/.env.example "${DRIVE_PATH}"/.env +cp "${DRIVE_PATH}"/.env.local "${DRIVE_PATH}"/.env # WALLET-LIB: WALLET_LIB_ENV_FILE_PATH=${WALLET_LIB_PATH}/.env From 81ea7f1df42752bbff8ca8fcbc99664b7bf3e8cc Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Wed, 10 Jan 2024 18:38:32 +0700 Subject: [PATCH 15/51] style: fix JS linter warning --- packages/dashmate/configs/getConfigFileMigrationsFactory.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/dashmate/configs/getConfigFileMigrationsFactory.js b/packages/dashmate/configs/getConfigFileMigrationsFactory.js index 935b80a43aa..bfeecedca92 100644 --- a/packages/dashmate/configs/getConfigFileMigrationsFactory.js +++ b/packages/dashmate/configs/getConfigFileMigrationsFactory.js @@ -409,7 +409,6 @@ export default function getConfigFileMigrationsFactory(homeDir, defaultConfigs) '1.0.0-dev.1': (configFile) => { Object.entries(configFile.configs) .forEach(([name, options]) => { - let baseConfigName = name; if (options.group !== null && defaultConfigs.has(options.group)) { baseConfigName = options.group; From 26746798985f835a42d14194877e3cf5e5b999fb Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sun, 14 Jan 2024 23:22:55 +0700 Subject: [PATCH 16/51] logging --- .../update_quorum_info/v0/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index ebfe7f2ac1d..57ccf4ef185 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -81,6 +81,17 @@ where .retain(|quorum_hash, _| { let retain = validator_quorums_list.contains_key::(quorum_hash); removed_a_validator_set |= !retain; + + if !retain { + tracing::trace!( + ?quorum_hash, + quorum_type = ?self.config.quorum_type(), + "removed validator set {} with quorum type {}", + quorum_hash, + self.config.quorum_type() + ) + } + retain }); @@ -172,6 +183,9 @@ where .collect(); let previous_quorums = block_platform_state .replace_chain_lock_validating_quorums(chain_lock_validating_quorums); + tracing::trace!( + "updated chain lock validating quorums to current validator set", + ); block_platform_state.set_previous_chain_lock_validating_quorums( block_platform_state.last_committed_core_height(), previous_quorums, From c5eb06d55d648b36bad1ba83a2799ca89fe03e7e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 15 Jan 2024 04:52:42 +0700 Subject: [PATCH 17/51] more work on tests --- .../rs-drive-abci/src/abci/handler/mod.rs | 6 +- packages/rs-drive-abci/src/config.rs | 13 +- .../update_quorum_info/v0/mod.rs | 8 +- .../data_contract_update/mod.rs | 2 +- .../tests/strategy_tests/chain_lock_update.rs | 88 ++++ .../tests/strategy_tests/core_update_tests.rs | 45 +- .../tests/strategy_tests/execution.rs | 125 ++++- .../tests/strategy_tests/failures.rs | 26 +- .../tests/strategy_tests/main.rs | 465 ++++-------------- .../tests/strategy_tests/query.rs | 48 +- .../tests/strategy_tests/strategy.rs | 8 +- .../strategy_tests/upgrade_fork_tests.rs | 27 +- 12 files changed, 366 insertions(+), 495 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index aba6fcb95b8..9aaa24c8013 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -180,9 +180,11 @@ where // propose one // This is done before all else + let state = self.platform.state.read().unwrap(); + let core_chain_lock_update = match self.platform.core_rpc.get_best_chain_lock() { Ok(latest_chain_lock) => { - if request.core_chain_locked_height < latest_chain_lock.block_height { + if latest_chain_lock.block_height > state.last_committed_core_height() { Some(latest_chain_lock) } else { None @@ -191,6 +193,8 @@ where Err(_) => None, }; + drop(state); + // Filter out transactions exceeding max_block_size let mut transactions_exceeding_max_block_size = Vec::new(); { diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 3e383ec9f09..99dda5cb76e 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -195,8 +195,11 @@ pub struct PlatformConfig { /// The quorum type used for verifying chain locks pub chain_lock_quorum_type: String, - /// The default quorum size - pub quorum_size: u16, + /// The validator set quorum size + pub validator_set_quorum_size: u16, + + /// The chain lock quorum size + pub chain_lock_quorum_size: u16, /// The window for chain locks /// On Mainnet Chain Locks are signed using 400_60: One quorum in every 288 blocks and activeQuorumCount is 4. @@ -327,7 +330,8 @@ impl PlatformConfig { Self { validator_set_quorum_type: "llmq_25_67".to_string(), chain_lock_quorum_type: "llmq_50_60".to_string(), - quorum_size: 25, + validator_set_quorum_size: 25, + chain_lock_quorum_size: 50, chain_lock_quorum_window: 24, block_spacing_ms: 5000, drive: Default::default(), @@ -344,7 +348,8 @@ impl PlatformConfig { Self { validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_400_60".to_string(), - quorum_size: 100, + validator_set_quorum_size: 100, + chain_lock_quorum_size: 400, chain_lock_quorum_window: 288, block_spacing_ms: 5000, drive: Default::default(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 57ccf4ef185..b70b587ec70 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -85,10 +85,10 @@ where if !retain { tracing::trace!( ?quorum_hash, - quorum_type = ?self.config.quorum_type(), + quorum_type = ?self.config.validator_set_quorum_type(), "removed validator set {} with quorum type {}", quorum_hash, - self.config.quorum_type() + self.config.validator_set_quorum_type() ) } @@ -183,9 +183,7 @@ where .collect(); let previous_quorums = block_platform_state .replace_chain_lock_validating_quorums(chain_lock_validating_quorums); - tracing::trace!( - "updated chain lock validating quorums to current validator set", - ); + tracing::trace!("updated chain lock validating quorums to current validator set",); block_platform_state.set_previous_chain_lock_validating_quorums( block_platform_state.last_committed_core_height(), previous_quorums, diff --git a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs index 151eca048e8..43c3b37d4d7 100644 --- a/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs +++ b/packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/data_contract_update/mod.rs @@ -147,7 +147,7 @@ mod tests { .data_contract_owned(); let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, execution: ExecutionConfig { verify_sum_trees: true, validator_set_quorum_rotation_block_count: 25, diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index e69de29bb2d..f94538664e5 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -0,0 +1,88 @@ +#[cfg(test)] +mod tests { + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::{BlockHash, ChainLock}; + use tenderdash_abci::proto::types::CoreChainLock; + + use crate::execution::run_chain_for_strategy; + use crate::strategy::{MasternodeListChangesStrategy, NetworkStrategy}; + use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; + use drive_abci::platform_types::validator_set::v0::ValidatorSetV0Getters; + use drive_abci::test::helpers::setup::TestPlatformBuilder; + use strategy_tests::frequency::Frequency; + use strategy_tests::Strategy; + + #[test] + fn run_chain_lock_update_quorums_not_changing() { + // The point of this test is to check that chain locks can be validated in the + // simple case where quorums do not change + let strategy = NetworkStrategy { + strategy: Strategy { + contracts_with_updates: vec![], + operations: vec![], + start_identities: vec![], + identities_inserts: Frequency { + times_per_block_range: Default::default(), + chance_per_block: None, + }, + signer: None, + }, + total_hpmns: 100, + extra_normal_mns: 400, + validator_quorum_count: 24, + chain_lock_quorum_count: 4, + upgrading_info: None, + core_height_increase: Frequency { + times_per_block_range: 1..2, + chance_per_block: None, + }, + proposer_strategy: MasternodeListChangesStrategy { + new_hpmns: Default::default(), + removed_hpmns: Default::default(), + updated_hpmns: Default::default(), + banned_hpmns: Default::default(), + unbanned_hpmns: Default::default(), + changed_ip_hpmns: Default::default(), + changed_p2p_port_hpmns: Default::default(), + changed_http_port_hpmns: Default::default(), + new_masternodes: Default::default(), + removed_masternodes: Default::default(), + updated_masternodes: Default::default(), + banned_masternodes: Default::default(), + unbanned_masternodes: Default::default(), + changed_ip_masternodes: Default::default(), + }, + rotate_quorums: true, + failure_testing: None, + query_testing: None, + verify_state_transition_results: false, + ..Default::default() + }; + + let quorum_size = 100; + + let config = PlatformConfig { + validator_set_quorum_size: quorum_size, + validator_set_quorum_type: "llmq_100_67".to_string(), + chain_lock_quorum_type: "llmq_400_60".to_string(), + execution: ExecutionConfig { + verify_sum_trees: true, + validator_set_quorum_rotation_block_count: 25, + ..Default::default() + }, + block_spacing_ms: 3000, + testing_configs: PlatformTestConfig::default_with_no_block_signing(), + ..Default::default() + }; + let mut platform = TestPlatformBuilder::new() + .with_config(config.clone()) + .build_with_mock_rpc(); + + let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); + + // we expect to see quorums with banned members + + let state = outcome.abci_app.platform.state.read().unwrap(); + } +} diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index e00b51ffcea..645172e8f77 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -28,7 +28,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -63,7 +64,7 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set_quorum_size: quorum_size, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -79,16 +80,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 1, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); // we expect to see quorums with banned members @@ -136,7 +127,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -171,7 +163,7 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set_quorum_size: quorum_size, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -187,16 +179,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 1, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); // we expect to see quorums with banned members @@ -230,7 +212,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -268,7 +251,7 @@ mod tests { let quorum_size = 100; let config = PlatformConfig { - quorum_size, + validator_set_quorum_size: quorum_size, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -284,16 +267,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 1, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let outcome = run_chain_for_strategy(&mut platform, 26, strategy, config, 13); // We should also see validator sets with less than the quorum size diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index aee63d84097..d4afbb24b59 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -20,6 +20,7 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV use strategy_tests::operations::FinalizeBlockOperation::IdentityAddKeys; use dashcore_rpc::json::{ExtendedQuorumListResult, SoftforkInfo}; +use dpp::dashcore::ChainLock; use drive_abci::abci::AbciApplication; use drive_abci::config::PlatformConfig; use drive_abci::mimic::test_quorum::TestQuorumInfo; @@ -45,8 +46,10 @@ pub(crate) fn run_chain_for_strategy( config: PlatformConfig, seed: u64, ) -> ChainExecutionOutcome { - let quorum_count = strategy.quorum_count; // We assume 24 quorums - let quorum_size = config.quorum_size; + let validator_quorum_count = strategy.validator_quorum_count; // In most tests 24 quorums + let chain_lock_quorum_count = strategy.chain_lock_quorum_count; // In most tests 4 quorums when not the same as validator + let validator_set_quorum_size = config.validator_set_quorum_size; + let chain_lock_quorum_size = config.chain_lock_quorum_size; let mut rng = StdRng::seed_from_u64(seed); @@ -189,28 +192,33 @@ pub(crate) fn run_chain_for_strategy( ) }; + let initial_all_masternodes: Vec<_> = initial_masternodes_with_updates + .into_iter() + .chain(initial_hpmns_with_updates.clone()) + .collect(); + let all_hpmns_with_updates = with_extra_hpmns_with_updates .iter() .max_by_key(|(key, _)| *key) .map(|(_, v)| v.clone()) .unwrap_or(initial_hpmns_with_updates.clone()); - let total_quorums = if strategy.rotate_quorums { - quorum_count * 10 + let total_validator_quorums = if strategy.rotate_quorums { + validator_quorum_count * 10 } else { - quorum_count + validator_quorum_count }; - let quorums = masternodes::generate_test_quorums( - total_quorums as usize, + let validator_quorums = masternodes::generate_test_quorums( + total_validator_quorums as usize, initial_hpmns_with_updates .iter() .map(|hpmn| &hpmn.masternode), - quorum_size as usize, + validator_set_quorum_size as usize, &mut rng, ); - let mut quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = quorums + let mut quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = validator_quorums .keys() .map(|quorum_hash| { ( @@ -228,6 +236,47 @@ pub(crate) fn run_chain_for_strategy( quorums_details.shuffle(&mut rng); + let (chain_lock_quorums, chain_lock_quorums_details) = + if config.validator_set_quorum_type != config.chain_lock_quorum_type { + let total_chain_lock_quorums = if strategy.rotate_quorums { + chain_lock_quorum_count * 10 + } else { + chain_lock_quorum_count + }; + + let chain_lock_quorums = masternodes::generate_test_quorums( + total_chain_lock_quorums as usize, + initial_all_masternodes + .iter() + .map(|masternode| &masternode.masternode), + chain_lock_quorum_size as usize, + &mut rng, + ); + + let mut chain_lock_quorums_details: Vec<(QuorumHash, ExtendedQuorumDetails)> = + chain_lock_quorums + .keys() + .map(|quorum_hash| { + ( + *quorum_hash, + ExtendedQuorumDetails { + creation_height: 0, + quorum_index: None, + mined_block_hash: BlockHash::all_zeros(), + num_valid_members: 0, + health_ratio: 0.0, + }, + ) + }) + .collect(); + + chain_lock_quorums_details.shuffle(&mut rng); + + (chain_lock_quorums, chain_lock_quorums_details) + } else { + (BTreeMap::new(), vec![]) + }; + let start_core_height = platform.config.abci.genesis_core_height; platform @@ -266,15 +315,15 @@ pub(crate) fn run_chain_for_strategy( .core_rpc .expect_get_quorum_listextended() .returning(move |core_height: Option| { - let extended_info = if !strategy.rotate_quorums { + let validator_set_extended_info = if !strategy.rotate_quorums { quorums_details.clone().into_iter().collect() } else { let core_height = core_height.expect("expected a core height"); // if we rotate quorums we shouldn't give back the same ones every time let start_range = core_height / 24; - let end_range = start_range + quorum_count as u32; - let start_range = start_range % total_quorums as u32; - let end_range = end_range % total_quorums as u32; + let end_range = start_range + validator_quorum_count as u32; + let start_range = start_range % total_validator_quorums as u32; + let end_range = end_range % total_validator_quorums as u32; if end_range > start_range { quorums_details @@ -287,7 +336,7 @@ pub(crate) fn run_chain_for_strategy( let first_range = quorums_details .iter() .skip(start_range as usize) - .take((total_quorums as u32 - start_range) as usize); + .take((total_validator_quorums as u32 - start_range) as usize); let second_range = quorums_details.iter().take(end_range as usize); first_range .chain(second_range) @@ -296,15 +345,24 @@ pub(crate) fn run_chain_for_strategy( } }; - let result = ExtendedQuorumListResult { - quorums_by_type: HashMap::from([(QuorumType::Llmq100_67, extended_info)]), - }; + let mut quorums_by_type = + HashMap::from([(QuorumType::Llmq100_67, validator_set_extended_info)]); + + if !chain_lock_quorums_details.is_empty() { + quorums_by_type.insert( + QuorumType::Llmq400_60, + chain_lock_quorums_details.clone().into_iter().collect(), + ); + } + + let result = ExtendedQuorumListResult { quorums_by_type }; Ok(result) }); - let quorums_info: HashMap = quorums + let all_quorums_info: HashMap = validator_quorums .iter() + .chain(chain_lock_quorums.iter()) .map(|(quorum_hash, test_quorum_info)| (*quorum_hash, test_quorum_info.into())) .collect(); @@ -312,17 +370,12 @@ pub(crate) fn run_chain_for_strategy( .core_rpc .expect_get_quorum_info() .returning(move |_, quorum_hash: &QuorumHash, _| { - Ok(quorums_info + Ok(all_quorums_info .get::(quorum_hash) .unwrap_or_else(|| panic!("expected to get quorum {}", hex::encode(quorum_hash))) .clone()) }); - let initial_all_masternodes: Vec<_> = initial_masternodes_with_updates - .into_iter() - .chain(initial_hpmns_with_updates.clone()) - .collect(); - platform .core_rpc .expect_get_protx_diff_with_masternodes() @@ -467,11 +520,31 @@ pub(crate) fn run_chain_for_strategy( Ok(diff) }); + let mut core_height = strategy.initial_core_height; + + let core_height_increase = strategy.core_height_increase.clone(); + let mut core_height_rng = rng.clone(); + + platform + .core_rpc + .expect_get_best_chain_lock() + .returning(move || { + let chain_lock = ChainLock { + block_height: core_height, + block_hash: BlockHash::from_byte_array([1; 32]), + signature: [2; 96].into(), + }; + + core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; + + Ok(chain_lock) + }); + create_chain_for_strategy( platform, block_count, all_hpmns_with_updates, - quorums, + validator_quorums, strategy, config, rng, @@ -613,7 +686,7 @@ pub(crate) fn continue_chain_for_strategy( StrategyRandomness::SeedEntropy(seed) => StdRng::seed_from_u64(seed), StrategyRandomness::RNGEntropy(rng) => rng, }; - let quorum_size = config.quorum_size; + let quorum_size = config.validator_set_quorum_size; let first_block_time = start_time_ms; let mut current_identities = vec![]; let mut signer = strategy.strategy.signer.clone().unwrap_or_default(); diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index afe453ff708..608b783a62d 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -63,7 +63,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -83,7 +84,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -98,16 +99,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); outcome @@ -150,7 +142,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -170,7 +163,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -218,7 +211,7 @@ mod tests { // We use the dpns contract and we insert two documents both with the same "name" // This is a common scenario we should see quite often let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -354,7 +347,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 519798bd183..6c15bebdfc9 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -47,6 +47,7 @@ use strategy::{ }; use strategy_tests::Strategy; +mod chain_lock_update; mod core_update_tests; mod execution; mod failures; @@ -132,7 +133,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -146,7 +148,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -162,16 +164,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); run_chain_for_strategy(&mut platform, 100, strategy, config, 15); } @@ -190,7 +182,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -204,7 +197,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -220,16 +213,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); run_chain_for_strategy(&mut platform, 50, strategy, config, 13); } @@ -248,7 +231,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -262,7 +246,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -281,17 +265,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); - let ChainExecutionOutcome { abci_app, proposers, @@ -386,7 +359,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -406,7 +380,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -425,17 +399,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); - let ChainExecutionOutcome { abci_app, proposers, @@ -531,7 +494,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -545,7 +509,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -560,16 +524,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15); let balance = outcome @@ -602,7 +557,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..3, @@ -616,7 +572,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -632,16 +588,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); } @@ -660,7 +606,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..3, @@ -675,7 +622,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -691,16 +638,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -725,7 +663,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..3, @@ -741,7 +680,7 @@ mod tests { let hour_in_s = 60 * 60; let three_mins_in_ms = 1000 * 60 * 3; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -758,16 +697,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -795,7 +725,8 @@ mod tests { }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 5..6, @@ -809,7 +740,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -825,16 +756,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let ChainExecutionOutcome { abci_app, .. } = run_chain_for_strategy(&mut platform, 2000, strategy, config, 40); @@ -881,7 +802,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -901,7 +823,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -917,16 +839,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let ChainExecutionOutcome { abci_app, .. } = run_chain_for_strategy(&mut platform, 300, strategy, config, 43); @@ -954,7 +866,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -978,7 +891,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -994,16 +907,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let ChainExecutionOutcome { abci_app, .. } = run_chain_for_strategy(&mut platform, 300, strategy, config, 43); @@ -1030,7 +933,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -1050,7 +954,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 10, + validator_set_quorum_size: 10, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1066,16 +970,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let ChainExecutionOutcome { abci_app, proposers, @@ -1133,7 +1027,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1152,7 +1047,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1167,16 +1062,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 100, strategy, config, 15); assert_eq!(outcome.identities.len(), 100); @@ -1197,7 +1083,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1212,7 +1099,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1228,16 +1115,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 150, strategy, config, 15); assert_eq!(outcome.identities.len(), 150); assert_eq!(outcome.masternode_identity_balances.len(), 100); @@ -1284,7 +1162,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1298,7 +1177,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1313,16 +1192,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15); outcome @@ -1398,7 +1268,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1412,7 +1283,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1427,16 +1298,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); outcome @@ -1507,7 +1369,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1521,7 +1384,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1536,16 +1399,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + run_chain_for_strategy(&mut platform, 100, strategy, config, 15); } @@ -1592,7 +1446,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1607,7 +1462,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1623,16 +1478,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); @@ -1705,7 +1551,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1720,7 +1567,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1736,16 +1583,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); @@ -1818,7 +1656,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1833,7 +1672,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1850,16 +1689,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); assert_eq!(outcome.identities.len() as u64, block_count); assert_eq!(outcome.masternode_identity_balances.len(), 100); @@ -1945,7 +1775,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -1962,7 +1793,7 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1979,16 +1810,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); assert_eq!(outcome.identities.len() as u64, 421); assert_eq!(outcome.masternode_identity_balances.len(), 100); @@ -2078,7 +1900,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -2095,7 +1918,7 @@ mod tests { let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2112,16 +1935,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, block_count, strategy, config, 15); assert_eq!(outcome.identities.len() as u64, 86); assert_eq!(outcome.masternode_identity_balances.len(), 100); @@ -2156,7 +1970,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -2170,7 +1985,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2185,16 +2000,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); let max_initial_balance = 100000000000u64; // TODO: some centralized way for random test data (`arbitrary` maybe?) @@ -2240,7 +2046,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -2256,7 +2063,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2271,16 +2078,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); let state = outcome.abci_app.platform.state.read().unwrap(); let protocol_version = state.current_protocol_version_in_consensus(); @@ -2331,7 +2129,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -2347,7 +2146,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2362,16 +2161,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); let identities = outcome @@ -2429,7 +2219,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -2445,7 +2236,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2460,16 +2251,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 10, strategy, config, 15); assert_eq!(outcome.identities.len(), 10); @@ -2492,7 +2274,7 @@ mod tests { }, total_hpmns: 50, extra_normal_mns: 0, - quorum_count: 10, + validator_quorum_count: 10, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -2507,7 +2289,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2651,7 +2433,7 @@ mod tests { }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -2666,7 +2448,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2781,7 +2563,7 @@ mod tests { }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..2, @@ -2796,7 +2578,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2911,7 +2693,7 @@ mod tests { }, total_hpmns: 500, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -2926,7 +2708,7 @@ mod tests { }; let day_in_ms = 1000 * 60 * 60 * 24; let config = PlatformConfig { - quorum_size: 3, + validator_set_quorum_size: 3, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -2946,17 +2728,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); - let ChainExecutionOutcome { abci_app, proposers, @@ -3055,7 +2826,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), @@ -3070,7 +2842,7 @@ mod tests { }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -3086,16 +2858,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 15, strategy, config, 15); let balances = &outcome @@ -3130,7 +2893,7 @@ mod tests { ..Default::default() }; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -3145,16 +2908,6 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); let outcome = run_chain_for_strategy(&mut platform, 1, strategy, config, 15); let state_transitions = outcome diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index b9d6d0f4dea..5ed09f895da 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -393,7 +393,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..3, @@ -408,7 +409,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -424,16 +425,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -506,7 +498,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..3, @@ -521,7 +514,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -537,16 +530,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome @@ -620,7 +604,8 @@ mod tests { }, total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: 1..3, @@ -635,7 +620,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -651,16 +636,7 @@ mod tests { let mut platform = TestPlatformBuilder::new() .with_config(config.clone()) .build_with_mock_rpc(); - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - Ok(ChainLock { - block_height: 10, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); + let outcome = run_chain_for_strategy(&mut platform, 1000, strategy, config, 15); assert_eq!(outcome.masternode_identity_balances.len(), 100); let all_have_balances = outcome diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index 9bb4013dadf..6995b537e9e 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -159,7 +159,9 @@ pub struct NetworkStrategy { pub strategy: Strategy, pub total_hpmns: u16, pub extra_normal_mns: u16, - pub quorum_count: u16, + pub validator_quorum_count: u16, + pub chain_lock_quorum_count: u16, + pub initial_core_height: u32, pub upgrading_info: Option, pub core_height_increase: Frequency, pub proposer_strategy: MasternodeListChangesStrategy, @@ -176,7 +178,9 @@ impl Default for NetworkStrategy { strategy: Default::default(), total_hpmns: 100, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, + initial_core_height: 1, upgrading_info: None, core_height_increase: Frequency { times_per_block_range: Default::default(), 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 aae849c6ed2..0cc626ccb04 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 @@ -45,7 +45,8 @@ mod tests { }, total_hpmns: 460, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], @@ -64,7 +65,7 @@ mod tests { }; let twenty_minutes_in_ms = 1000 * 60 * 20; let mut config = PlatformConfig { - quorum_size: 100, + validator_set_quorum_size: 100, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -316,7 +317,8 @@ mod tests { }, total_hpmns: 50, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], @@ -336,7 +338,7 @@ mod tests { let one_hour_in_s = 60 * 60; let thirty_seconds_in_ms = 1000 * 30; let config = PlatformConfig { - quorum_size: 30, + validator_set_quorum_size: 30, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -580,7 +582,7 @@ mod tests { }, total_hpmns: 120, extra_normal_mns: 0, - quorum_count: 200, + validator_quorum_count: 200, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], @@ -599,7 +601,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 40, + validator_set_quorum_size: 40, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -843,7 +845,7 @@ mod tests { }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], @@ -862,7 +864,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let mut config = PlatformConfig { - quorum_size: 50, + validator_set_quorum_size: 50, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1023,7 +1025,7 @@ mod tests { }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: Some(UpgradingInfo { current_protocol_version: 2, proposed_protocol_versions_with_weight: vec![ @@ -1207,7 +1209,7 @@ mod tests { }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 100, + validator_quorum_count: 100, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![ @@ -1230,7 +1232,7 @@ mod tests { }; let hour_in_ms = 1000 * 60 * 60; let config = PlatformConfig { - quorum_size: 50, + validator_set_quorum_size: 50, validator_set_quorum_type: "llmq_100_67".to_string(), chain_lock_quorum_type: "llmq_100_67".to_string(), execution: ExecutionConfig { @@ -1322,7 +1324,8 @@ mod tests { }, total_hpmns: 200, extra_normal_mns: 0, - quorum_count: 24, + validator_quorum_count: 24, + chain_lock_quorum_count: 24, upgrading_info: Some(UpgradingInfo { current_protocol_version: 1, proposed_protocol_versions_with_weight: vec![ From dedcef2c059e811acf7d31a9fa70c4d70b6a9cff Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Mon, 15 Jan 2024 22:58:40 +0700 Subject: [PATCH 18/51] more work --- packages/rs-drive-abci/src/mimic/mod.rs | 53 +++++++++++++++---- .../tests/strategy_tests/chain_lock_update.rs | 1 + .../tests/strategy_tests/execution.rs | 3 +- .../tests/strategy_tests/strategy.rs | 4 +- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/packages/rs-drive-abci/src/mimic/mod.rs b/packages/rs-drive-abci/src/mimic/mod.rs index ab37a9265ba..da445c7c5a6 100644 --- a/packages/rs-drive-abci/src/mimic/mod.rs +++ b/packages/rs-drive-abci/src/mimic/mod.rs @@ -29,6 +29,8 @@ use tenderdash_abci::proto::types::{ use tenderdash_abci::signatures::SignBytes; use tenderdash_abci::{signatures::SignDigest, proto::version::Consensus, Application}; use tenderdash_abci::proto::abci::tx_record::TxAction; +use crate::execution::types::block_execution_context::v0::BlockExecutionContextV0Getters; +use crate::execution::types::block_state_info::v0::BlockStateInfoV0Getters; use crate::mimic::test_quorum::TestQuorumInfo; /// Test quorum for mimic block execution @@ -65,6 +67,10 @@ pub struct MimicExecuteBlockOptions { pub dont_finalize_block: bool, /// rounds before finalization pub rounds_before_finalization: Option, + /// max tx bytes per block + pub max_tx_bytes_per_block: u64, + /// run process proposal independently + pub independent_process_proposal_verification: bool, } impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { @@ -80,7 +86,6 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { expect_validation_errors: &[u32], expect_vote_extension_errors: bool, state_transitions: Vec, - max_tx_bytes_per_block: i64, options: MimicExecuteBlockOptions, ) -> Result { const APP_VERSION: u64 = 0; @@ -106,7 +111,7 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { // PREPARE (also processes internally) let request_prepare_proposal = RequestPrepareProposal { - max_tx_bytes: max_tx_bytes_per_block, + max_tx_bytes: options.max_tx_bytes_per_block as i64, txs: serialized_state_transitions.clone(), local_last_commit: None, misbehavior: vec![], @@ -217,14 +222,42 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { quorum_hash: current_quorum.quorum_hash.to_byte_array().to_vec(), }; - //we must call process proposal so the app hash is set - self.process_proposal(request_process_proposal) - .unwrap_or_else(|e| { - panic!( - "should skip processing (because we prepared it) block #{} at time #{} : {:?}", - block_info.height, block_info.time_ms, e - ) - }); + + + if !options.independent_process_proposal_verification { + //we just check as if we were the proposer + //we must call process proposal so the app hash is set + self.process_proposal(request_process_proposal) + .unwrap_or_else(|e| { + panic!( + "should skip processing (because we prepared it) block #{} at time #{} : {:?}", + block_info.height, block_info.time_ms, e + ) + }); + } else { + //we first call process proposal as the proposer + //we must call process proposal so the app hash is set + self.process_proposal(request_process_proposal.clone()) + .unwrap_or_else(|e| { + panic!( + "should skip processing (because we prepared it) block #{} at time #{} : {:?}", + block_info.height, block_info.time_ms, e + ) + }); + + let block_execution_context = self.platform.block_execution_context.read().unwrap().expect("expected a block execution context"); + + let application_hash = block_execution_context.block_state_info().app_hash().expect("expected an application hash after process proposal"); + + //we call process proposal as if we are a processor + self.process_proposal(request_process_proposal) + .unwrap_or_else(|e| { + panic!( + "should skip processing (because we prepared it) block #{} at time #{} : {:?}", + block_info.height, block_info.time_ms, e + ) + }); + } let request_extend_vote = RequestExtendVote { hash: block_header_hash.to_vec(), diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index f94538664e5..cc833c07b3d 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -57,6 +57,7 @@ mod tests { failure_testing: None, query_testing: None, verify_state_transition_results: false, + independent_process_proposal_verification: true, ..Default::default() }; diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index d4afbb24b59..7228a7d9ee4 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -820,12 +820,13 @@ pub(crate) fn continue_chain_for_strategy( expected_validation_errors.as_slice(), false, state_transitions.clone(), - strategy.max_tx_bytes_per_block, MimicExecuteBlockOptions { dont_finalize_block: strategy.dont_finalize_block(), rounds_before_finalization: strategy.failure_testing.as_ref().and_then( |failure_testing| failure_testing.rounds_before_successful_block, ), + max_tx_bytes_per_block: strategy.max_tx_bytes_per_block, + independent_process_proposal_verification: strategy.independent_process_proposal_verification, }, ) .expect("expected to execute a block"), diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index 6995b537e9e..b41bed7e944 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -169,7 +169,8 @@ pub struct NetworkStrategy { pub failure_testing: Option, pub query_testing: Option, pub verify_state_transition_results: bool, - pub max_tx_bytes_per_block: i64, + pub max_tx_bytes_per_block: u64, + pub independent_process_proposal_verification: bool, } impl Default for NetworkStrategy { @@ -192,6 +193,7 @@ impl Default for NetworkStrategy { query_testing: None, verify_state_transition_results: false, max_tx_bytes_per_block: 44800, + independent_process_proposal_verification: false, } } } From 33934387d67db6f8c042370f4bfb34ca4e74ab1c Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 18 Jan 2024 14:02:35 +0700 Subject: [PATCH 19/51] chain lock signing --- .../rs-drive-abci/src/abci/handler/mod.rs | 6 ++ .../core_chain_lock/choose_quorum/mod.rs | 26 ++++- .../core_chain_lock/choose_quorum/v0/mod.rs | 32 ++++++- .../verify_chain_lock_locally/v0/mod.rs | 2 +- .../types/block_execution_context/mod.rs | 2 +- .../types/block_execution_context/v0/mod.rs | 2 +- .../execution/types/block_state_info/mod.rs | 2 +- .../types/block_state_info/v0/mod.rs | 2 +- packages/rs-drive-abci/src/mimic/mod.rs | 76 ++++++++++++++- .../src/platform_types/epoch_info/mod.rs | 2 +- .../src/platform_types/epoch_info/v0/mod.rs | 2 +- .../tests/strategy_tests/chain_lock_update.rs | 1 + .../tests/strategy_tests/execution.rs | 96 +++++++++++++++++-- .../tests/strategy_tests/strategy.rs | 2 + packages/strategy-tests/src/frequency.rs | 4 + 15 files changed, 235 insertions(+), 22 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 9aaa24c8013..9d09c80f86d 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -367,6 +367,12 @@ where elapsed_time_ms, ); + let a = self.platform + .drive + .grove + .root_hash(Some(transaction)) + .unwrap().expect("a"); //GroveDb errors are system errors + Ok(response) } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs index e6969fa2ab7..3288760e118 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -21,7 +21,6 @@ where /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums /// pub fn choose_quorum<'a>( - &self, llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8; 32], @@ -33,7 +32,7 @@ where .core_chain_lock .choose_quorum { - 0 => Ok(self.choose_quorum_v0(llmq_quorum_type, quorums, request_id, platform_version)), + 0 => Ok(Self::choose_quorum_v0(llmq_quorum_type, quorums, request_id, platform_version)), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "choose_quorum".to_string(), known_versions: vec![0], @@ -41,4 +40,27 @@ where })), } } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + /// + pub fn choose_quorum_thread_safe<'a, const T: usize>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + platform_version: &PlatformVersion, + ) -> Result, Error> { + match platform_version + .drive_abci + .methods + .core_chain_lock + .choose_quorum + { + 0 => Ok(Self::choose_quorum_thread_safe_v0(llmq_quorum_type, quorums, request_id, platform_version)), + version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { + method: "choose_quorum_thread_safe".to_string(), + known_versions: vec![0], + received: version, + })), + } + } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index 6120dbcb410..ec1f447819b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -19,7 +19,6 @@ where { /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums pub(super) fn choose_quorum_v0<'a>( - &self, llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8; 32], @@ -48,4 +47,35 @@ where scores.sort_by_key(|k| k.2); scores.first().map(|&(hash, key, _)| (hash, key)) } + + /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums + pub(super) fn choose_quorum_thread_safe_v0<'a, const T: usize>( + llmq_quorum_type: QuorumType, + quorums: &'a BTreeMap, + request_id: &[u8; 32], + _platform_version: &PlatformVersion, + ) -> Option<(&'a QuorumHash, &'a [u8;T])> { + // Scoring system logic + let mut scores: Vec<(&QuorumHash, &[u8;T], [u8; 32])> = Vec::new(); + + for (quorum_hash, key) in quorums { + let mut hasher = sha256d::Hash::engine(); + + // Serialize and hash the LLMQ type + hasher.input(&[llmq_quorum_type as u8]); + + // Serialize and add the quorum hash + hasher.input(quorum_hash.as_byte_array()); + + // Serialize and add the selection hash from the chain lock + hasher.input(request_id.as_slice()); + + // Finalize the hash + let hash_result = sha256d::Hash::from_engine(hasher); + scores.push((quorum_hash, key, hash_result.into())); + } + + scores.sort_by_key(|k| k.2); + scores.first().map(|&(hash, key, _)| (hash, key)) + } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 1c1523126c1..6e8d691b29d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -81,7 +81,7 @@ where // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined - let quorum = self.choose_quorum( + let quorum = Platform::::choose_quorum( self.config.chain_lock_quorum_type(), quorums, request_id.as_ref(), diff --git a/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs b/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs index 0ff0b617492..89e78136e97 100644 --- a/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_execution_context/mod.rs @@ -15,7 +15,7 @@ use std::collections::BTreeMap; use tenderdash_abci::proto::abci::ResponsePrepareProposal; /// The versioned block execution context -#[derive(Debug, From)] +#[derive(Debug, From, Clone)] pub enum BlockExecutionContext { /// Version 0 V0(v0::BlockExecutionContextV0), diff --git a/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs index 33cd7fa2f19..587407bb47b 100644 --- a/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_execution_context/v0/mod.rs @@ -36,7 +36,7 @@ use std::collections::BTreeMap; use tenderdash_abci::proto::abci::ResponsePrepareProposal; /// V0 of the Block execution context -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct BlockExecutionContextV0 { /// Block info pub block_state_info: BlockStateInfo, diff --git a/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs b/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs index 86e794cc001..684bcaaa569 100644 --- a/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_state_info/mod.rs @@ -11,7 +11,7 @@ use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; /// The versioned block state info -#[derive(Debug, From)] +#[derive(Debug, From, Clone, Eq, PartialEq)] pub enum BlockStateInfo { /// Version 0 V0(v0::BlockStateInfoV0), diff --git a/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs index 1b58804fdbb..8e3b405e651 100644 --- a/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/types/block_state_info/v0/mod.rs @@ -34,7 +34,7 @@ use dpp::block::block_info::BlockInfo; use dpp::block::epoch::Epoch; /// Block info -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct BlockStateInfoV0 { /// Block height pub height: u64, diff --git a/packages/rs-drive-abci/src/mimic/mod.rs b/packages/rs-drive-abci/src/mimic/mod.rs index da445c7c5a6..fcbdb5058fe 100644 --- a/packages/rs-drive-abci/src/mimic/mod.rs +++ b/packages/rs-drive-abci/src/mimic/mod.rs @@ -88,6 +88,25 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { state_transitions: Vec, options: MimicExecuteBlockOptions, ) -> Result { + + let transaction_guard = self.transaction.read().unwrap(); + + let transaction = transaction_guard.as_ref().ok_or(Error::Execution( + ExecutionError::NotInTransaction( + "trying to finalize block without a current transaction", + ), + ))?; + + let init_chain_root_hash = self + .platform + .drive + .grove + .root_hash(Some(transaction)) + .unwrap() + .unwrap(); + + drop(transaction_guard); + const APP_VERSION: u64 = 0; let mut rng = StdRng::seed_from_u64(block_info.height); @@ -235,6 +254,9 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { ) }); } else { + + let original_block_execution_context = self.platform.block_execution_context.read().unwrap().as_ref().cloned(); + //we first call process proposal as the proposer //we must call process proposal so the app hash is set self.process_proposal(request_process_proposal.clone()) @@ -245,9 +267,36 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { ) }); - let block_execution_context = self.platform.block_execution_context.read().unwrap().expect("expected a block execution context"); + let mut block_execution_context = self.platform.block_execution_context.write().unwrap(); + + let application_hash = block_execution_context.as_ref().expect("expected a block execution context").block_state_info().app_hash().expect("expected an application hash after process proposal"); - let application_hash = block_execution_context.block_state_info().app_hash().expect("expected an application hash after process proposal"); + *block_execution_context = original_block_execution_context.clone(); + drop(block_execution_context); + + if request_process_proposal.height == self.platform.config.abci.genesis_height as i64 + { + // special logic on init chain + let transaction = self.transaction.write().unwrap(); + + let transaction = transaction.as_ref().ok_or(Error::Execution( + ExecutionError::NotInTransaction( + "trying to finalize block without a current transaction", + ), + ))?; + + transaction.rollback_to_savepoint().expect("expected to rollback to savepoint"); + + let start_root_hash = self + .platform + .drive + .grove + .root_hash(Some(transaction)) + .unwrap() + .unwrap(); + assert_eq!(start_root_hash, init_chain_root_hash); + // this is just to verify that the rollback worked. + }; //we call process proposal as if we are a processor self.process_proposal(request_process_proposal) @@ -257,6 +306,29 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { block_info.height, block_info.time_ms, e ) }); + + let block_execution_context = self.platform.block_execution_context.read().unwrap(); + + let process_proposal_application_hash = block_execution_context.as_ref().expect("expected a block execution context").block_state_info().app_hash().expect("expected an application hash after process proposal"); + + assert_eq!(application_hash, process_proposal_application_hash, "the application hashed are not valid for height {}", block_info.height); + + let transaction_guard = self.transaction.read().unwrap(); + + let transaction = transaction_guard.as_ref().ok_or(Error::Execution( + ExecutionError::NotInTransaction( + "trying to finalize block without a current transaction", + ), + ))?; + + let direct_root_hash = self + .platform + .drive + .grove + .root_hash(Some(transaction)) + .unwrap() + .unwrap(); + assert_eq!(application_hash, direct_root_hash, "the application hashed are not valid for height {}", block_info.height); } let request_extend_vote = RequestExtendVote { diff --git a/packages/rs-drive-abci/src/platform_types/epoch_info/mod.rs b/packages/rs-drive-abci/src/platform_types/epoch_info/mod.rs index 4d20118a553..78dac32a8c1 100644 --- a/packages/rs-drive-abci/src/platform_types/epoch_info/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/epoch_info/mod.rs @@ -15,7 +15,7 @@ use serde::{Deserialize, Serialize}; pub mod v0; /// Info pertinent to the current epoch. -#[derive(Clone, Serialize, Deserialize, Debug, From)] +#[derive(Clone, Serialize, Deserialize, Debug, From, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub enum EpochInfo { /// Version 0 diff --git a/packages/rs-drive-abci/src/platform_types/epoch_info/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/epoch_info/v0/mod.rs index 81a1c62c3b9..b0891428c72 100644 --- a/packages/rs-drive-abci/src/platform_types/epoch_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/epoch_info/v0/mod.rs @@ -45,7 +45,7 @@ use rust_decimal::Decimal; use serde::{Deserialize, Serialize}; /// Info pertinent to the current epoch. -#[derive(Clone, Serialize, Deserialize, Debug)] +#[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq)] #[serde(rename_all = "camelCase")] pub struct EpochInfoV0 { /// Current epoch index diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index cc833c07b3d..41fd27d8063 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -58,6 +58,7 @@ mod tests { query_testing: None, verify_state_transition_results: false, independent_process_proposal_verification: true, + sign_chain_locks: true, ..Default::default() }; diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index 7228a7d9ee4..e3d1e643e81 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -20,7 +20,7 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV use strategy_tests::operations::FinalizeBlockOperation::IdentityAddKeys; use dashcore_rpc::json::{ExtendedQuorumListResult, SoftforkInfo}; -use dpp::dashcore::ChainLock; +use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; use drive_abci::abci::AbciApplication; use drive_abci::config::PlatformConfig; use drive_abci::mimic::test_quorum::TestQuorumInfo; @@ -28,16 +28,20 @@ use drive_abci::mimic::{MimicExecuteBlockOptions, MimicExecuteBlockOutcome}; use drive_abci::platform_types::epoch_info::v0::EpochInfoV0; use drive_abci::platform_types::platform::Platform; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; -use drive_abci::rpc::core::MockCoreRPCLike; +use drive_abci::rpc::core::{CoreRPCLike, MockCoreRPCLike}; use drive_abci::test::fixture::abci::static_init_chain_request; use rand::prelude::{SliceRandom, StdRng}; -use rand::SeedableRng; +use rand::{Rng, SeedableRng}; use std::collections::{BTreeMap, HashMap}; use tenderdash_abci::proto::abci::{ResponseInitChain, ValidatorSetUpdate}; use tenderdash_abci::proto::crypto::public_key::Sum::Bls12381; use tenderdash_abci::proto::google::protobuf::Timestamp; use tenderdash_abci::proto::serializers::timestamp::FromMilis; use tenderdash_abci::Application; +use dpp::bls_signatures::PrivateKey; +use dpp::dashcore::consensus::Encodable; +use dpp::dashcore::hashes::{HashEngine, sha256d}; +use platform_version::version::PlatformVersion; pub(crate) fn run_chain_for_strategy( platform: &mut Platform, @@ -56,6 +60,18 @@ pub(crate) fn run_chain_for_strategy( let any_changes_in_strategy = strategy.proposer_strategy.any_is_set(); let updated_proposers_in_strategy = strategy.proposer_strategy.any_kind_of_update_is_set(); + let max_core_height = strategy.initial_core_height + strategy.core_height_increase.max_event_count() as u32 * block_count as u32; + + let chain_lock_quorum_type = config.chain_lock_quorum_type(); + + let sign_chain_locks = strategy.sign_chain_locks; + + let mut core_blocks = BTreeMap::new(); + for x in strategy.initial_core_height..max_core_height { + let block_hash : [u8;32] = rng.gen(); + core_blocks.insert(x, block_hash); + } + let ( initial_masternodes_with_updates, initial_hpmns_with_updates, @@ -525,19 +541,79 @@ pub(crate) fn run_chain_for_strategy( let core_height_increase = strategy.core_height_increase.clone(); let mut core_height_rng = rng.clone(); + let chain_lock_quorums_private_keys: BTreeMap = chain_lock_quorums.iter().map(|(quorum_hash, info)| { + let bytes = info.private_key.to_bytes(); + let fixed_bytes: [u8; 32] = bytes.as_slice().try_into().expect("Expected a byte array of length 32"); + (quorum_hash.clone(), fixed_bytes) + }).collect(); + platform .core_rpc .expect_get_best_chain_lock() .returning(move || { - let chain_lock = ChainLock { - block_height: core_height, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }; - core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; + let block_hash = *core_blocks.get(&core_height).expect("expected a block hash to be known"); + + if sign_chain_locks { + + // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks + // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. + + let mut engine = QuorumSigningRequestId::engine(); + + // Prefix + let prefix_len = VarInt("clsig".len() as u64); + prefix_len + .consensus_encode(&mut engine) + .expect("expected to encode the prefix"); + + engine.input("clsig".as_bytes()); + engine.input(core_height.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined - Ok(chain_lock) + let quorum = Platform::::choose_quorum_thread_safe( + chain_lock_quorum_type, + &chain_lock_quorums_private_keys, + request_id.as_ref(), + PlatformVersion::latest(), //it should be okay to use latest here + ).expect("expected a quorum"); + + let (quorum_hash, quorum_private_key) = quorum.expect("expected to find a quorum"); + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[chain_lock_quorum_type as u8]); + engine.input(quorum_hash.as_byte_array()); + engine.input(request_id.as_byte_array()); + engine.input(&block_hash); + + let message_digest = sha256d::Hash::from_engine(engine); + + let quorum_private_key = PrivateKey::from_bytes(quorum_private_key.as_slice(), false).expect("expected to have a valid private key"); + let signature = quorum_private_key.sign(message_digest.as_byte_array()); + let chain_lock = ChainLock { + block_height: core_height, + block_hash: BlockHash::from_byte_array(block_hash), + signature: (*signature.to_bytes()).into(), + }; + + core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; + + Ok(chain_lock) + } else { + let chain_lock = ChainLock { + block_height: core_height, + block_hash: BlockHash::from_byte_array(block_hash), + signature: [2; 96].into(), + }; + + Ok(chain_lock) + } }); create_chain_for_strategy( diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index b41bed7e944..e39ef831d6b 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -171,6 +171,7 @@ pub struct NetworkStrategy { pub verify_state_transition_results: bool, pub max_tx_bytes_per_block: u64, pub independent_process_proposal_verification: bool, + pub sign_chain_locks: bool, } impl Default for NetworkStrategy { @@ -194,6 +195,7 @@ impl Default for NetworkStrategy { verify_state_transition_results: false, max_tx_bytes_per_block: 44800, independent_process_proposal_verification: false, + sign_chain_locks: false, } } } diff --git a/packages/strategy-tests/src/frequency.rs b/packages/strategy-tests/src/frequency.rs index a846a27f316..8b46d8ec7f2 100644 --- a/packages/strategy-tests/src/frequency.rs +++ b/packages/strategy-tests/src/frequency.rs @@ -64,6 +64,10 @@ impl Frequency { } } + pub fn max_event_count(&self) -> u16 { + self.times_per_block_range.end + } + pub fn pick_in_range(&self, rng: &mut impl Rng, range: Range) -> Vec { if !self.is_set() || range.is_empty() { return vec![]; From 036e460415fd3296ffef3824ae511df44062d885 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 18 Jan 2024 16:51:34 +0700 Subject: [PATCH 20/51] chain locks verified --- .../rs-drive-abci/src/abci/handler/mod.rs | 8 +-- packages/rs-drive-abci/src/config.rs | 1 + .../core_chain_lock/choose_quorum/mod.rs | 18 +++-- .../core_chain_lock/choose_quorum/v0/mod.rs | 6 +- .../verify_chain_lock_locally/v0/mod.rs | 2 +- packages/rs-drive-abci/src/mimic/mod.rs | 70 ++++++++++++------- .../tests/strategy_tests/chain_lock_update.rs | 2 +- .../tests/strategy_tests/execution.rs | 50 ++++++++----- 8 files changed, 99 insertions(+), 58 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 9d09c80f86d..12731427282 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -367,12 +367,6 @@ where elapsed_time_ms, ); - let a = self.platform - .drive - .grove - .root_hash(Some(transaction)) - .unwrap().expect("a"); //GroveDb errors are system errors - Ok(response) } @@ -387,7 +381,7 @@ where let mut drop_block_execution_context = false; if let Some(block_execution_context) = block_execution_context_guard.as_mut() { - // We are already in a block + // We are already in a block, or in init chain. // This only makes sense if we were the proposer unless we are at a future round if block_execution_context.block_state_info().round() != (request.round as u32) { // We were not the proposer, and we should process something new diff --git a/packages/rs-drive-abci/src/config.rs b/packages/rs-drive-abci/src/config.rs index 480b5a5e4c8..1667097503d 100644 --- a/packages/rs-drive-abci/src/config.rs +++ b/packages/rs-drive-abci/src/config.rs @@ -302,6 +302,7 @@ impl PlatformConfig { validator_set_quorum_type: "llmq_test_platform".to_string(), chain_lock_quorum_type: "llmq_test".to_string(), validator_set_quorum_size: 3, + chain_lock_quorum_size: 3, chain_lock_quorum_window: 24, block_spacing_ms: 5000, drive: Default::default(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs index 3288760e118..a2203dff73a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -32,7 +32,12 @@ where .core_chain_lock .choose_quorum { - 0 => Ok(Self::choose_quorum_v0(llmq_quorum_type, quorums, request_id, platform_version)), + 0 => Ok(Self::choose_quorum_v0( + llmq_quorum_type, + quorums, + request_id, + platform_version, + )), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "choose_quorum".to_string(), known_versions: vec![0], @@ -45,17 +50,22 @@ where /// pub fn choose_quorum_thread_safe<'a, const T: usize>( llmq_quorum_type: QuorumType, - quorums: &'a BTreeMap, + quorums: &'a BTreeMap, request_id: &[u8; 32], platform_version: &PlatformVersion, - ) -> Result, Error> { + ) -> Result, Error> { match platform_version .drive_abci .methods .core_chain_lock .choose_quorum { - 0 => Ok(Self::choose_quorum_thread_safe_v0(llmq_quorum_type, quorums, request_id, platform_version)), + 0 => Ok(Self::choose_quorum_thread_safe_v0( + llmq_quorum_type, + quorums, + request_id, + platform_version, + )), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "choose_quorum_thread_safe".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index ec1f447819b..416a160b9b3 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -51,12 +51,12 @@ where /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums pub(super) fn choose_quorum_thread_safe_v0<'a, const T: usize>( llmq_quorum_type: QuorumType, - quorums: &'a BTreeMap, + quorums: &'a BTreeMap, request_id: &[u8; 32], _platform_version: &PlatformVersion, - ) -> Option<(&'a QuorumHash, &'a [u8;T])> { + ) -> Option<(&'a QuorumHash, &'a [u8; T])> { // Scoring system logic - let mut scores: Vec<(&QuorumHash, &[u8;T], [u8; 32])> = Vec::new(); + let mut scores: Vec<(&QuorumHash, &[u8; T], [u8; 32])> = Vec::new(); for (quorum_hash, key) in quorums { let mut hasher = sha256d::Hash::engine(); diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 6e8d691b29d..dea9adc12b6 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -44,7 +44,7 @@ where + window_width - 1; - let verification_height = chain_lock.block_height - SIGN_OFFSET; + let verification_height = chain_lock.block_height.saturating_sub(SIGN_OFFSET); if verification_height > last_block_in_window { return Ok(None); // the chain lock is too far in the future or the past to verify locally diff --git a/packages/rs-drive-abci/src/mimic/mod.rs b/packages/rs-drive-abci/src/mimic/mod.rs index fcbdb5058fe..640a6baa1ad 100644 --- a/packages/rs-drive-abci/src/mimic/mod.rs +++ b/packages/rs-drive-abci/src/mimic/mod.rs @@ -88,22 +88,25 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { state_transitions: Vec, options: MimicExecuteBlockOptions, ) -> Result { + // This will be NONE, except on init chain + let original_block_execution_context = self + .platform + .block_execution_context + .read() + .unwrap() + .as_ref() + .cloned(); let transaction_guard = self.transaction.read().unwrap(); - let transaction = transaction_guard.as_ref().ok_or(Error::Execution( - ExecutionError::NotInTransaction( - "trying to finalize block without a current transaction", - ), - ))?; - - let init_chain_root_hash = self - .platform - .drive - .grove - .root_hash(Some(transaction)) - .unwrap() - .unwrap(); + let init_chain_root_hash = transaction_guard.as_ref().map(|transaction| { + self.platform + .drive + .grove + .root_hash(Some(transaction)) + .unwrap() + .unwrap() + }); drop(transaction_guard); @@ -241,8 +244,6 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { quorum_hash: current_quorum.quorum_hash.to_byte_array().to_vec(), }; - - if !options.independent_process_proposal_verification { //we just check as if we were the proposer //we must call process proposal so the app hash is set @@ -254,9 +255,6 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { ) }); } else { - - let original_block_execution_context = self.platform.block_execution_context.read().unwrap().as_ref().cloned(); - //we first call process proposal as the proposer //we must call process proposal so the app hash is set self.process_proposal(request_process_proposal.clone()) @@ -267,14 +265,21 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { ) }); - let mut block_execution_context = self.platform.block_execution_context.write().unwrap(); + let mut block_execution_context = + self.platform.block_execution_context.write().unwrap(); - let application_hash = block_execution_context.as_ref().expect("expected a block execution context").block_state_info().app_hash().expect("expected an application hash after process proposal"); + let application_hash = block_execution_context + .as_ref() + .expect("expected a block execution context") + .block_state_info() + .app_hash() + .expect("expected an application hash after process proposal"); *block_execution_context = original_block_execution_context.clone(); drop(block_execution_context); - if request_process_proposal.height == self.platform.config.abci.genesis_height as i64 + if let Some(init_chain_root_hash) = init_chain_root_hash + //we are in init chain { // special logic on init chain let transaction = self.transaction.write().unwrap(); @@ -285,7 +290,9 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { ), ))?; - transaction.rollback_to_savepoint().expect("expected to rollback to savepoint"); + transaction + .rollback_to_savepoint() + .expect("expected to rollback to savepoint"); let start_root_hash = self .platform @@ -309,9 +316,18 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { let block_execution_context = self.platform.block_execution_context.read().unwrap(); - let process_proposal_application_hash = block_execution_context.as_ref().expect("expected a block execution context").block_state_info().app_hash().expect("expected an application hash after process proposal"); + let process_proposal_application_hash = block_execution_context + .as_ref() + .expect("expected a block execution context") + .block_state_info() + .app_hash() + .expect("expected an application hash after process proposal"); - assert_eq!(application_hash, process_proposal_application_hash, "the application hashed are not valid for height {}", block_info.height); + assert_eq!( + application_hash, process_proposal_application_hash, + "the application hashed are not valid for height {}", + block_info.height + ); let transaction_guard = self.transaction.read().unwrap(); @@ -328,7 +344,11 @@ impl<'a, C: CoreRPCLike> AbciApplication<'a, C> { .root_hash(Some(transaction)) .unwrap() .unwrap(); - assert_eq!(application_hash, direct_root_hash, "the application hashed are not valid for height {}", block_info.height); + assert_eq!( + application_hash, direct_root_hash, + "the application hashed are not valid for height {}", + block_info.height + ); } let request_extend_vote = RequestExtendVote { diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index 41fd27d8063..fbe96f23994 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -70,7 +70,7 @@ mod tests { chain_lock_quorum_type: "llmq_400_60".to_string(), execution: ExecutionConfig { verify_sum_trees: true, - validator_set_quorum_rotation_block_count: 25, + validator_set_rotation_block_count: 25, ..Default::default() }, block_spacing_ms: 3000, diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index e3d1e643e81..b16c58b3289 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -20,6 +20,9 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV use strategy_tests::operations::FinalizeBlockOperation::IdentityAddKeys; use dashcore_rpc::json::{ExtendedQuorumListResult, SoftforkInfo}; +use dpp::bls_signatures::PrivateKey; +use dpp::dashcore::consensus::Encodable; +use dpp::dashcore::hashes::{sha256d, HashEngine}; use dpp::dashcore::{ChainLock, QuorumSigningRequestId, VarInt}; use drive_abci::abci::AbciApplication; use drive_abci::config::PlatformConfig; @@ -30,6 +33,7 @@ use drive_abci::platform_types::platform::Platform; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; use drive_abci::rpc::core::{CoreRPCLike, MockCoreRPCLike}; use drive_abci::test::fixture::abci::static_init_chain_request; +use platform_version::version::PlatformVersion; use rand::prelude::{SliceRandom, StdRng}; use rand::{Rng, SeedableRng}; use std::collections::{BTreeMap, HashMap}; @@ -38,10 +42,6 @@ use tenderdash_abci::proto::crypto::public_key::Sum::Bls12381; use tenderdash_abci::proto::google::protobuf::Timestamp; use tenderdash_abci::proto::serializers::timestamp::FromMilis; use tenderdash_abci::Application; -use dpp::bls_signatures::PrivateKey; -use dpp::dashcore::consensus::Encodable; -use dpp::dashcore::hashes::{HashEngine, sha256d}; -use platform_version::version::PlatformVersion; pub(crate) fn run_chain_for_strategy( platform: &mut Platform, @@ -60,7 +60,8 @@ pub(crate) fn run_chain_for_strategy( let any_changes_in_strategy = strategy.proposer_strategy.any_is_set(); let updated_proposers_in_strategy = strategy.proposer_strategy.any_kind_of_update_is_set(); - let max_core_height = strategy.initial_core_height + strategy.core_height_increase.max_event_count() as u32 * block_count as u32; + let max_core_height = strategy.initial_core_height + + strategy.core_height_increase.max_event_count() as u32 * block_count as u32; let chain_lock_quorum_type = config.chain_lock_quorum_type(); @@ -68,7 +69,7 @@ pub(crate) fn run_chain_for_strategy( let mut core_blocks = BTreeMap::new(); for x in strategy.initial_core_height..max_core_height { - let block_hash : [u8;32] = rng.gen(); + let block_hash: [u8; 32] = rng.gen(); core_blocks.insert(x, block_hash); } @@ -541,21 +542,27 @@ pub(crate) fn run_chain_for_strategy( let core_height_increase = strategy.core_height_increase.clone(); let mut core_height_rng = rng.clone(); - let chain_lock_quorums_private_keys: BTreeMap = chain_lock_quorums.iter().map(|(quorum_hash, info)| { - let bytes = info.private_key.to_bytes(); - let fixed_bytes: [u8; 32] = bytes.as_slice().try_into().expect("Expected a byte array of length 32"); - (quorum_hash.clone(), fixed_bytes) - }).collect(); + let chain_lock_quorums_private_keys: BTreeMap = chain_lock_quorums + .iter() + .map(|(quorum_hash, info)| { + let bytes = info.private_key.to_bytes(); + let fixed_bytes: [u8; 32] = bytes + .as_slice() + .try_into() + .expect("Expected a byte array of length 32"); + (quorum_hash.clone(), fixed_bytes) + }) + .collect(); platform .core_rpc .expect_get_best_chain_lock() .returning(move || { - - let block_hash = *core_blocks.get(&core_height).expect("expected a block hash to be known"); + let block_hash = *core_blocks + .get(&core_height) + .expect("expected a block hash to be known"); if sign_chain_locks { - // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. @@ -579,7 +586,8 @@ pub(crate) fn run_chain_for_strategy( &chain_lock_quorums_private_keys, request_id.as_ref(), PlatformVersion::latest(), //it should be okay to use latest here - ).expect("expected a quorum"); + ) + .expect("expected a quorum"); let (quorum_hash, quorum_private_key) = quorum.expect("expected to find a quorum"); @@ -594,7 +602,9 @@ pub(crate) fn run_chain_for_strategy( let message_digest = sha256d::Hash::from_engine(engine); - let quorum_private_key = PrivateKey::from_bytes(quorum_private_key.as_slice(), false).expect("expected to have a valid private key"); + let quorum_private_key = + PrivateKey::from_bytes(quorum_private_key.as_slice(), false) + .expect("expected to have a valid private key"); let signature = quorum_private_key.sign(message_digest.as_byte_array()); let chain_lock = ChainLock { block_height: core_height, @@ -616,6 +626,11 @@ pub(crate) fn run_chain_for_strategy( } }); + platform + .core_rpc + .expect_submit_chain_lock() + .returning(move |chain_lock: &ChainLock| return Ok(true)); + create_chain_for_strategy( platform, block_count, @@ -902,7 +917,8 @@ pub(crate) fn continue_chain_for_strategy( |failure_testing| failure_testing.rounds_before_successful_block, ), max_tx_bytes_per_block: strategy.max_tx_bytes_per_block, - independent_process_proposal_verification: strategy.independent_process_proposal_verification, + independent_process_proposal_verification: strategy + .independent_process_proposal_verification, }, ) .expect("expected to execute a block"), From 08d49bf80b6d27b48c46d21336d494129beb2e74 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 18 Jan 2024 16:57:16 +0700 Subject: [PATCH 21/51] chain locks verified --- .../src/execution/engine/run_block_proposal/v0/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 68edcc7305c..22e360789ed 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -143,8 +143,12 @@ where found_valid_by_core, } = match verification_result { Ok(verification_result) => verification_result, + Err(Error::Execution(e)) => { + // This will happen only if an internal version error + return Err(Error::Execution(e)); + } Err(e) => { - // This will happen if the signature is not + // This will happen only if a core rpc error return Ok(ValidationResult::new_with_error( AbciError::InvalidChainLock(e.to_string()).into(), )); From e6ef437211d3e8fa841c21911ba00114bc1d1929 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 19 Jan 2024 02:36:28 +0700 Subject: [PATCH 22/51] more fixes --- packages/rs-drive-abci/.env.local | 3 +- .../rs-drive-abci/src/abci/handler/mod.rs | 6 +- .../tests/strategy_tests/chain_lock_update.rs | 5 +- .../tests/strategy_tests/core_update_tests.rs | 13 +- .../tests/strategy_tests/execution.rs | 65 ++++--- .../tests/strategy_tests/failures.rs | 34 +--- .../tests/strategy_tests/main.rs | 163 ++++++------------ .../tests/strategy_tests/query.rs | 13 +- .../tests/strategy_tests/strategy.rs | 65 ++++++- .../strategy_tests/upgrade_fork_tests.rs | 35 +--- 10 files changed, 187 insertions(+), 215 deletions(-) diff --git a/packages/rs-drive-abci/.env.local b/packages/rs-drive-abci/.env.local index 4c336aa003d..c131e8c2401 100644 --- a/packages/rs-drive-abci/.env.local +++ b/packages/rs-drive-abci/.env.local @@ -24,12 +24,13 @@ CORE_JSON_RPC_PASSWORD=password INITIAL_CORE_CHAINLOCKED_HEIGHT=1243 # https://github.com/dashevo/dashcore-lib/blob/286c33a9d29d33f05d874c47a9b33764a0be0cf1/lib/constants/index.js#L42-L57 -VALIDATOR_SET_LLMQ_TYPE=llmq_test +VALIDATOR_SET_QUORUM_TYPE=llmq_test VALIDATOR_SET_QUORUM_SIZE=3 VALIDATOR_SET_ROTATION_BLOCK_COUNT=64 CHAIN_LOCK_QUORUM_TYPE=llmq_test CHAIN_LOCK_QUORUM_WINDOW=24 +CHAIN_LOCK_QUORUM_SIZE=3 # DPNS Contract diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 12731427282..dbf7999cbfb 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -182,9 +182,11 @@ where let state = self.platform.state.read().unwrap(); + let last_committed_core_height = state.last_committed_core_height(); + let core_chain_lock_update = match self.platform.core_rpc.get_best_chain_lock() { Ok(latest_chain_lock) => { - if latest_chain_lock.block_height > state.last_committed_core_height() { + if state.last_committed_block_info().is_none() || latest_chain_lock.block_height > last_committed_core_height { Some(latest_chain_lock) } else { None @@ -226,6 +228,8 @@ where request.height ); block_proposal.core_chain_locked_height = core_chain_lock_update.block_height; + } else { + block_proposal.core_chain_locked_height = last_committed_core_height; } // Prepare transaction diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index fbe96f23994..fa887b1d4ef 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -12,6 +12,7 @@ mod tests { use drive_abci::test::helpers::setup::TestPlatformBuilder; use strategy_tests::frequency::Frequency; use strategy_tests::Strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; #[test] fn run_chain_lock_update_quorums_not_changing() { @@ -33,10 +34,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 4, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Default::default(), diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index 635572229fe..46328050441 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -12,6 +12,7 @@ mod tests { use drive_abci::test::helpers::setup::TestPlatformBuilder; use strategy_tests::frequency::Frequency; use strategy_tests::Strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; #[test] fn run_chain_random_bans() { @@ -31,10 +32,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Default::default(), @@ -130,10 +131,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Frequency { @@ -215,10 +216,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Default::default(), removed_hpmns: Default::default(), diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index b16c58b3289..c3243f5a80b 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -1,10 +1,7 @@ use crate::masternodes; use crate::masternodes::{GenerateTestMasternodeUpdates, MasternodeListItemWithUpdates}; use crate::query::ProofVerification; -use crate::strategy::{ - ChainExecutionOutcome, ChainExecutionParameters, NetworkStrategy, StrategyRandomness, - ValidatorVersionMigration, -}; +use crate::strategy::{ChainExecutionOutcome, ChainExecutionParameters, CoreHeightIncrease, NetworkStrategy, StrategyRandomness, ValidatorVersionMigration}; use crate::verify_state_transitions::verify_state_transitions_were_or_were_not_executed; use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::{BlockHash, ProTxHash, QuorumHash}; @@ -60,16 +57,19 @@ pub(crate) fn run_chain_for_strategy( let any_changes_in_strategy = strategy.proposer_strategy.any_is_set(); let updated_proposers_in_strategy = strategy.proposer_strategy.any_kind_of_update_is_set(); - let max_core_height = strategy.initial_core_height - + strategy.core_height_increase.max_event_count() as u32 * block_count as u32; + let core_height_increase = strategy.core_height_increase.clone(); + + let max_core_height = core_height_increase.max_core_height(block_count, strategy.initial_core_height); let chain_lock_quorum_type = config.chain_lock_quorum_type(); let sign_chain_locks = strategy.sign_chain_locks; let mut core_blocks = BTreeMap::new(); - for x in strategy.initial_core_height..max_core_height { - let block_hash: [u8; 32] = rng.gen(); + let mut block_rng = StdRng::seed_from_u64(rng.gen()); // so we don't need to regenerate tests + + for x in strategy.initial_core_height..max_core_height + 1 { + let block_hash: [u8; 32] = block_rng.gen(); core_blocks.insert(x, block_hash); } @@ -79,9 +79,7 @@ pub(crate) fn run_chain_for_strategy( with_extra_masternodes_with_updates, with_extra_hpmns_with_updates, ) = if any_changes_in_strategy { - let approximate_end_core_height = - ((block_count as f64) * strategy.core_height_increase.average_event_count()) as u32; - let end_core_height = approximate_end_core_height * 2; //let's be safe + let end_core_height = strategy.core_height_increase.max_core_height(block_count, strategy.initial_core_height); let generate_updates = if updated_proposers_in_strategy { Some(GenerateTestMasternodeUpdates { start_core_height: config.abci.genesis_core_height, @@ -539,7 +537,7 @@ pub(crate) fn run_chain_for_strategy( let mut core_height = strategy.initial_core_height; - let core_height_increase = strategy.core_height_increase.clone(); + let mut core_height_increase = strategy.core_height_increase.clone(); let mut core_height_rng = rng.clone(); let chain_lock_quorums_private_keys: BTreeMap = chain_lock_quorums @@ -558,11 +556,24 @@ pub(crate) fn run_chain_for_strategy( .core_rpc .expect_get_best_chain_lock() .returning(move || { + let block_height = match &mut core_height_increase { + CoreHeightIncrease::NoCoreHeightIncrease | CoreHeightIncrease::RandomCoreHeightIncrease(_) => { + core_height + } + CoreHeightIncrease::KnownCoreHeightIncreases(core_block_heights) => { + if core_block_heights.len() == 1 { + *core_block_heights.first().unwrap() + } else { + core_block_heights.remove(0) + } + } + }; + let block_hash = *core_blocks - .get(&core_height) - .expect("expected a block hash to be known"); + .get(&block_height) + .expect(format!("expected a block hash to be known for {}", core_height).as_str()); - if sign_chain_locks { + let chain_lock = if sign_chain_locks { // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. @@ -612,7 +623,7 @@ pub(crate) fn run_chain_for_strategy( signature: (*signature.to_bytes()).into(), }; - core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; + Ok(chain_lock) } else { @@ -623,7 +634,13 @@ pub(crate) fn run_chain_for_strategy( }; Ok(chain_lock) - } + }; + + if let CoreHeightIncrease::RandomCoreHeightIncrease(core_height_increase) = &core_height_increase { + core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; + }; + + chain_lock }); platform @@ -811,21 +828,23 @@ pub(crate) fn continue_chain_for_strategy( let mut state_transition_results_per_block = BTreeMap::new(); for block_height in block_start..(block_start + block_count) { + let state = platform + .state + .read() + .expect("lock is poisoned"); let epoch_info = EpochInfoV0::calculate( first_block_time, current_time_ms, - platform - .state - .read() - .expect("lock is poisoned") - .last_committed_block_info() + state.last_committed_block_info() .as_ref() .map(|block_info| block_info.basic_info().time_ms), config.execution.epoch_time_length_s, ) .expect("should calculate epoch info"); - current_core_height += strategy.core_height_increase.events_if_hit(&mut rng) as u32; + current_core_height = state.last_committed_core_height(); + + drop(state); let block_info = BlockInfo { time_ms: current_time_ms, diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index 64a875bd129..018b69949b5 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -26,6 +26,7 @@ mod tests { use simple_signer::signer::SimpleSigner; use strategy_tests::operations::{DocumentAction, DocumentOp, Operation, OperationType}; use tenderdash_abci::proto::types::CoreChainLock; + use crate::strategy::CoreHeightIncrease::{KnownCoreHeightIncreases, NoCoreHeightIncrease}; #[test] fn run_chain_insert_one_new_identity_and_a_contract_with_bad_update() { @@ -66,10 +67,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -145,10 +143,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -350,11 +345,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, - + core_height_increase: KnownCoreHeightIncreases(vec![10, 11]), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -369,23 +360,6 @@ mod tests { ..Default::default() }; - let mut core_block_heights = vec![10, 11]; - - platform - .core_rpc - .expect_get_best_chain_lock() - .returning(move || { - let block_height = if core_block_heights.len() == 1 { - *core_block_heights.first().unwrap() - } else { - core_block_heights.remove(0) - }; - Ok(ChainLock { - block_height, - block_hash: BlockHash::from_byte_array([1; 32]), - signature: [2; 96].into(), - }) - }); // On the first block we only have identities and contracts let outcome = run_chain_for_strategy(&mut platform, 2, strategy.clone(), config.clone(), 15); diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 2cb8db4d024..230d1b5277f 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -94,6 +94,7 @@ mod tests { use tenderdash_abci::proto::abci::{RequestInfo, ResponseInfo}; use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::Application; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; pub fn generate_quorums_extended_info(n: u32) -> QuorumListExtendedInfo { let mut quorums = QuorumListExtendedInfo::new(); @@ -136,10 +137,6 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -185,10 +182,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -234,10 +228,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -362,10 +353,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: Some(FailureStrategy { @@ -497,10 +485,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -539,7 +524,7 @@ mod tests { .expect("expected to fetch balances") .expect("expected to have an identity to get balance from"); - assert_eq!(balance, 99869074420) + assert_eq!(balance, 99868891100) } #[test] @@ -560,10 +545,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.01), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -609,10 +594,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -666,10 +651,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -728,10 +713,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 5..6, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -805,10 +790,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: Some(0.2), - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Frequency { times_per_block_range: 1..3, @@ -869,10 +854,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: Some(0.2), - }, + }), proposer_strategy: MasternodeListChangesStrategy { new_hpmns: Frequency { times_per_block_range: 1..3, @@ -936,10 +921,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: Some(0.2), - }, + }), proposer_strategy: MasternodeListChangesStrategy { updated_hpmns: Frequency { times_per_block_range: 1..3, @@ -1030,10 +1015,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1086,10 +1068,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1135,7 +1114,7 @@ mod tests { .unwrap() .unwrap() ), - "7185a9b987f4fe7290f048ccdb2935d92446c240b9361be46a20f956164a9378".to_string() + "3c6bd30ad909138e7b119ce92305fc328ae1110771b1395425495b6fe97f2c08".to_string() ) } @@ -1165,10 +1144,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1271,10 +1247,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1372,10 +1345,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1449,10 +1419,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1554,10 +1521,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1659,10 +1623,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1709,7 +1670,7 @@ mod tests { .unwrap() .unwrap() ), - "5dfc31d164388c22154e10629030edb5557620c5fcd5c87ffeff5f4e81bdb657".to_string() + "6964587ace67e307a3e48f3dc85c5d229d00123e46cca0267b79482a2ec8b8f2".to_string() ) } @@ -1778,10 +1739,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1903,10 +1861,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1973,10 +1928,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2049,10 +2001,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2132,10 +2081,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2222,10 +2168,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2276,10 +2219,10 @@ mod tests { extra_normal_mns: 0, validator_quorum_count: 10, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -2435,10 +2378,10 @@ mod tests { extra_normal_mns: 0, validator_quorum_count: 100, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -2504,7 +2447,7 @@ mod tests { ); assert_eq!( masternodes_fingerprint_a, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); let masternodes_fingerprint_b = hash_to_hex_string( outcome_b @@ -2515,7 +2458,7 @@ mod tests { ); assert_eq!( masternodes_fingerprint_b, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); let last_app_hash_a = outcome_a @@ -2565,10 +2508,10 @@ mod tests { extra_normal_mns: 0, validator_quorum_count: 100, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..2, chance_per_block: None, - }, + }), proposer_strategy: Default::default(), rotate_quorums: true, failure_testing: None, @@ -2633,7 +2576,7 @@ mod tests { ); assert_eq!( masternodes_fingerprint_a, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); let masternodes_fingerprint_b = hash_to_hex_string( outcome_b @@ -2644,7 +2587,7 @@ mod tests { ); assert_eq!( masternodes_fingerprint_b, - "3f13e499c5c49b04ab1edf2bbddca733fd9cf6f92875ccf51e827a6f4bf044e8".to_string() + "0154fd29f0062819ee6b8063ea02c9f3296ed9af33a4538ae98087edb1a75029".to_string() ); let last_app_hash_a = outcome_a @@ -2672,8 +2615,8 @@ mod tests { .into_iter() .filter(|(_, balance)| *balance != 0) .count(); - // we have a maximum 90 quorums, that could have been used, 4 were used twice - assert_eq!(balance_count, 86); + // we have a maximum 90 quorums, that could have been used, 6 were used twice + assert_eq!(balance_count, 84); } #[test] @@ -2695,10 +2638,7 @@ mod tests { extra_normal_mns: 0, validator_quorum_count: 100, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -2829,10 +2769,7 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index 42c709ef379..d132861fa54 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -353,6 +353,7 @@ mod tests { use dpp::dashcore::{BlockHash, ChainLock}; use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::Application; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; macro_rules! extract_single_variant_or_panic { ($expression:expr, $pattern:pat, $binding:ident) => { @@ -396,10 +397,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -501,10 +502,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -607,10 +608,10 @@ mod tests { validator_quorum_count: 24, chain_lock_quorum_count: 24, upgrading_info: None, - core_height_increase: Frequency { + core_height_increase: RandomCoreHeightIncrease(Frequency { times_per_block_range: 1..3, chance_per_block: Some(0.5), - }, + }), proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index e39ef831d6b..96998713e3c 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -52,6 +52,7 @@ use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use dpp::state_transition::data_contract_create_transition::methods::v0::DataContractCreateTransitionMethodsV0; use simple_signer::signer::SimpleSigner; +use crate::strategy::CoreHeightIncrease::NoCoreHeightIncrease; #[derive(Clone, Debug, Default)] pub struct MasternodeListChangesStrategy { @@ -154,6 +155,63 @@ pub struct MasternodeChanges { pub masternode_change_port_chance: Frequency, } +#[derive(Clone, Debug, Default)] +pub enum CoreHeightIncrease { + #[default] + NoCoreHeightIncrease, + RandomCoreHeightIncrease(Frequency), + KnownCoreHeightIncreases(Vec), +} + +impl CoreHeightIncrease { + pub fn max_core_height(&self, block_count: u64, initial_core_height: u32) -> u32 { + match self { + NoCoreHeightIncrease => { + initial_core_height + } + CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { + initial_core_height + + frequency.max_event_count() as u32 * block_count as u32 + } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => { + values.last().copied().unwrap_or(initial_core_height) + } + } + } + pub fn average_core_height(&self, block_count: u64, initial_core_height: u32) -> u32 { + match self { + NoCoreHeightIncrease => { + initial_core_height + } + CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { + initial_core_height + + frequency.average_event_count() as u32 * block_count as u32 + } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => { + values.get(values.len() / 2).copied().unwrap_or(initial_core_height) + } + } + } + + pub fn add_events_if_hit(&mut self, core_height: u32, rng: &mut StdRng) -> u32 { + match self { + NoCoreHeightIncrease => { + 0 + } + CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { + core_height + frequency.events_if_hit(rng) as u32 + } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => { + if values.len() == 1 { + *values.get(0).unwrap() + } else { + values.pop().unwrap() + } + } + } + } +} + #[derive(Clone, Debug)] pub struct NetworkStrategy { pub strategy: Strategy, @@ -163,7 +221,7 @@ pub struct NetworkStrategy { pub chain_lock_quorum_count: u16, pub initial_core_height: u32, pub upgrading_info: Option, - pub core_height_increase: Frequency, + pub core_height_increase: CoreHeightIncrease, pub proposer_strategy: MasternodeListChangesStrategy, pub rotate_quorums: bool, pub failure_testing: Option, @@ -184,10 +242,7 @@ impl Default for NetworkStrategy { chain_lock_quorum_count: 24, initial_core_height: 1, upgrading_info: None, - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + core_height_increase: NoCoreHeightIncrease, proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, 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 68600bbd425..8c6385cdfcc 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 @@ -52,10 +52,7 @@ mod tests { proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 0.1, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -324,10 +321,7 @@ mod tests { proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 0.2, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -588,10 +582,7 @@ mod tests { proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 5.0, //it will take many epochs before we get enough nodes }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -851,10 +842,7 @@ mod tests { proposed_protocol_versions_with_weight: vec![(TEST_PROTOCOL_VERSION_2, 1)], upgrade_three_quarters_life: 5.0, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1034,10 +1022,7 @@ mod tests { ], upgrade_three_quarters_life: 0.1, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1219,10 +1204,7 @@ mod tests { ], upgrade_three_quarters_life: 0.75, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, @@ -1334,10 +1316,7 @@ mod tests { ], upgrade_three_quarters_life: 0.5, }), - core_height_increase: Frequency { - times_per_block_range: Default::default(), - chance_per_block: None, - }, + proposer_strategy: Default::default(), rotate_quorums: false, failure_testing: None, From 632c744002808a17352ea181e42a028abb43aa2e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 20 Jan 2024 12:14:03 -0800 Subject: [PATCH 23/51] all tests passing --- .../rs-drive-abci/src/abci/handler/mod.rs | 4 ++- .../tests/strategy_tests/chain_lock_update.rs | 2 +- .../tests/strategy_tests/core_update_tests.rs | 2 +- .../tests/strategy_tests/execution.rs | 31 ++++++++++--------- .../tests/strategy_tests/failures.rs | 2 +- .../tests/strategy_tests/main.rs | 2 +- .../tests/strategy_tests/query.rs | 2 +- .../tests/strategy_tests/strategy.rs | 27 ++++++---------- .../strategy_tests/upgrade_fork_tests.rs | 18 +++++------ 9 files changed, 44 insertions(+), 46 deletions(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index dbf7999cbfb..37a497f1f9d 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -186,7 +186,9 @@ where let core_chain_lock_update = match self.platform.core_rpc.get_best_chain_lock() { Ok(latest_chain_lock) => { - if state.last_committed_block_info().is_none() || latest_chain_lock.block_height > last_committed_core_height { + if state.last_committed_block_info().is_none() + || latest_chain_lock.block_height > last_committed_core_height + { Some(latest_chain_lock) } else { None diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index fa887b1d4ef..d9b34bce2c4 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -5,6 +5,7 @@ mod tests { use tenderdash_abci::proto::types::CoreChainLock; use crate::execution::run_chain_for_strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; use crate::strategy::{MasternodeListChangesStrategy, NetworkStrategy}; use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -12,7 +13,6 @@ mod tests { use drive_abci::test::helpers::setup::TestPlatformBuilder; use strategy_tests::frequency::Frequency; use strategy_tests::Strategy; - use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; #[test] fn run_chain_lock_update_quorums_not_changing() { diff --git a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs index 46328050441..9c097506251 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/core_update_tests.rs @@ -5,6 +5,7 @@ mod tests { use tenderdash_abci::proto::types::CoreChainLock; use crate::execution::run_chain_for_strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; use crate::strategy::{MasternodeListChangesStrategy, NetworkStrategy}; use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; use drive_abci::platform_types::platform_state::v0::PlatformStateV0Methods; @@ -12,7 +13,6 @@ mod tests { use drive_abci::test::helpers::setup::TestPlatformBuilder; use strategy_tests::frequency::Frequency; use strategy_tests::Strategy; - use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; #[test] fn run_chain_random_bans() { diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index c3243f5a80b..7ff05ee57e0 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -1,7 +1,10 @@ use crate::masternodes; use crate::masternodes::{GenerateTestMasternodeUpdates, MasternodeListItemWithUpdates}; use crate::query::ProofVerification; -use crate::strategy::{ChainExecutionOutcome, ChainExecutionParameters, CoreHeightIncrease, NetworkStrategy, StrategyRandomness, ValidatorVersionMigration}; +use crate::strategy::{ + ChainExecutionOutcome, ChainExecutionParameters, CoreHeightIncrease, NetworkStrategy, + StrategyRandomness, ValidatorVersionMigration, +}; use crate::verify_state_transitions::verify_state_transitions_were_or_were_not_executed; use dashcore_rpc::dashcore::hashes::Hash; use dashcore_rpc::dashcore::{BlockHash, ProTxHash, QuorumHash}; @@ -59,7 +62,8 @@ pub(crate) fn run_chain_for_strategy( let core_height_increase = strategy.core_height_increase.clone(); - let max_core_height = core_height_increase.max_core_height(block_count, strategy.initial_core_height); + let max_core_height = + core_height_increase.max_core_height(block_count, strategy.initial_core_height); let chain_lock_quorum_type = config.chain_lock_quorum_type(); @@ -79,7 +83,9 @@ pub(crate) fn run_chain_for_strategy( with_extra_masternodes_with_updates, with_extra_hpmns_with_updates, ) = if any_changes_in_strategy { - let end_core_height = strategy.core_height_increase.max_core_height(block_count, strategy.initial_core_height); + let end_core_height = strategy + .core_height_increase + .max_core_height(block_count, strategy.initial_core_height); let generate_updates = if updated_proposers_in_strategy { Some(GenerateTestMasternodeUpdates { start_core_height: config.abci.genesis_core_height, @@ -557,9 +563,8 @@ pub(crate) fn run_chain_for_strategy( .expect_get_best_chain_lock() .returning(move || { let block_height = match &mut core_height_increase { - CoreHeightIncrease::NoCoreHeightIncrease | CoreHeightIncrease::RandomCoreHeightIncrease(_) => { - core_height - } + CoreHeightIncrease::NoCoreHeightIncrease + | CoreHeightIncrease::RandomCoreHeightIncrease(_) => core_height, CoreHeightIncrease::KnownCoreHeightIncreases(core_block_heights) => { if core_block_heights.len() == 1 { *core_block_heights.first().unwrap() @@ -623,8 +628,6 @@ pub(crate) fn run_chain_for_strategy( signature: (*signature.to_bytes()).into(), }; - - Ok(chain_lock) } else { let chain_lock = ChainLock { @@ -636,7 +639,9 @@ pub(crate) fn run_chain_for_strategy( Ok(chain_lock) }; - if let CoreHeightIncrease::RandomCoreHeightIncrease(core_height_increase) = &core_height_increase { + if let CoreHeightIncrease::RandomCoreHeightIncrease(core_height_increase) = + &core_height_increase + { core_height += core_height_increase.events_if_hit(&mut core_height_rng) as u32; }; @@ -828,14 +833,12 @@ pub(crate) fn continue_chain_for_strategy( let mut state_transition_results_per_block = BTreeMap::new(); for block_height in block_start..(block_start + block_count) { - let state = platform - .state - .read() - .expect("lock is poisoned"); + let state = platform.state.read().expect("lock is poisoned"); let epoch_info = EpochInfoV0::calculate( first_block_time, current_time_ms, - state.last_committed_block_info() + state + .last_committed_block_info() .as_ref() .map(|block_info| block_info.basic_info().time_ms), config.execution.epoch_time_length_s, diff --git a/packages/rs-drive-abci/tests/strategy_tests/failures.rs b/packages/rs-drive-abci/tests/strategy_tests/failures.rs index 018b69949b5..52fd3d1ef64 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/failures.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/failures.rs @@ -11,6 +11,7 @@ mod tests { use drive_abci::config::{ExecutionConfig, PlatformConfig, PlatformTestConfig}; + use crate::strategy::CoreHeightIncrease::{KnownCoreHeightIncreases, NoCoreHeightIncrease}; use dpp::dashcore::hashes::Hash; use dpp::dashcore::{BlockHash, ChainLock}; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; @@ -26,7 +27,6 @@ mod tests { use simple_signer::signer::SimpleSigner; use strategy_tests::operations::{DocumentAction, DocumentOp, Operation, OperationType}; use tenderdash_abci::proto::types::CoreChainLock; - use crate::strategy::CoreHeightIncrease::{KnownCoreHeightIncreases, NoCoreHeightIncrease}; #[test] fn run_chain_insert_one_new_identity_and_a_contract_with_bad_update() { diff --git a/packages/rs-drive-abci/tests/strategy_tests/main.rs b/packages/rs-drive-abci/tests/strategy_tests/main.rs index 230d1b5277f..e1b0fe3135a 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/main.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/main.rs @@ -75,6 +75,7 @@ mod tests { DocumentAction, DocumentOp, IdentityUpdateOp, Operation, OperationType, }; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; use dpp::dashcore::ChainLock; use dpp::data_contract::accessors::v0::{DataContractV0Getters, DataContractV0Setters}; use dpp::data_contract::document_type::random_document::{ @@ -94,7 +95,6 @@ mod tests { use tenderdash_abci::proto::abci::{RequestInfo, ResponseInfo}; use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::Application; - use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; pub fn generate_quorums_extended_info(n: u32) -> QuorumListExtendedInfo { let mut quorums = QuorumListExtendedInfo::new(); diff --git a/packages/rs-drive-abci/tests/strategy_tests/query.rs b/packages/rs-drive-abci/tests/strategy_tests/query.rs index d132861fa54..17ae1ce383a 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/query.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/query.rs @@ -349,11 +349,11 @@ mod tests { use strategy_tests::Strategy; + use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; use dpp::dashcore::hashes::Hash; use dpp::dashcore::{BlockHash, ChainLock}; use tenderdash_abci::proto::types::CoreChainLock; use tenderdash_abci::Application; - use crate::strategy::CoreHeightIncrease::RandomCoreHeightIncrease; macro_rules! extract_single_variant_or_panic { ($expression:expr, $pattern:pat, $binding:ident) => { diff --git a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs index 96998713e3c..1cae313520e 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/strategy.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/strategy.rs @@ -51,8 +51,8 @@ use dpp::state_transition::documents_batch_transition::document_transition::{Doc use drive::drive::document::query::QueryDocumentsOutcomeV0Methods; use dpp::state_transition::data_contract_create_transition::methods::v0::DataContractCreateTransitionMethodsV0; -use simple_signer::signer::SimpleSigner; use crate::strategy::CoreHeightIncrease::NoCoreHeightIncrease; +use simple_signer::signer::SimpleSigner; #[derive(Clone, Debug, Default)] pub struct MasternodeListChangesStrategy { @@ -166,12 +166,9 @@ pub enum CoreHeightIncrease { impl CoreHeightIncrease { pub fn max_core_height(&self, block_count: u64, initial_core_height: u32) -> u32 { match self { - NoCoreHeightIncrease => { - initial_core_height - } + NoCoreHeightIncrease => initial_core_height, CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { - initial_core_height - + frequency.max_event_count() as u32 * block_count as u32 + initial_core_height + frequency.max_event_count() as u32 * block_count as u32 } CoreHeightIncrease::KnownCoreHeightIncreases(values) => { values.last().copied().unwrap_or(initial_core_height) @@ -180,24 +177,20 @@ impl CoreHeightIncrease { } pub fn average_core_height(&self, block_count: u64, initial_core_height: u32) -> u32 { match self { - NoCoreHeightIncrease => { - initial_core_height - } + NoCoreHeightIncrease => initial_core_height, CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { - initial_core_height - + frequency.average_event_count() as u32 * block_count as u32 - } - CoreHeightIncrease::KnownCoreHeightIncreases(values) => { - values.get(values.len() / 2).copied().unwrap_or(initial_core_height) + initial_core_height + frequency.average_event_count() as u32 * block_count as u32 } + CoreHeightIncrease::KnownCoreHeightIncreases(values) => values + .get(values.len() / 2) + .copied() + .unwrap_or(initial_core_height), } } pub fn add_events_if_hit(&mut self, core_height: u32, rng: &mut StdRng) -> u32 { match self { - NoCoreHeightIncrease => { - 0 - } + NoCoreHeightIncrease => 0, CoreHeightIncrease::RandomCoreHeightIncrease(frequency) => { core_height + frequency.events_if_hit(rng) as u32 } 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 8c6385cdfcc..e3954dfd102 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 @@ -140,7 +140,7 @@ mod tests { ); assert_eq!( (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&16), Some(&416)) + (Some(&17), Some(&414)) ); //most nodes were hit (63 were not) } @@ -218,7 +218,7 @@ mod tests { TEST_PROTOCOL_VERSION_2 ); assert_eq!(counter.get(&1), None); //no one has proposed 1 yet - assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&157)); + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&154)); } // we locked in @@ -280,7 +280,7 @@ mod tests { TEST_PROTOCOL_VERSION_2 ); assert_eq!(counter.get(&1), None); //no one has proposed 1 yet - assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&120)); + assert_eq!(counter.get(&TEST_PROTOCOL_VERSION_2), Some(&122)); } }) .expect("Failed to create thread with custom stack size"); @@ -1072,7 +1072,7 @@ mod tests { let counter = &drive_cache.protocol_versions_counter; assert_eq!( (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&170), Some(&24)) + (Some(&172), Some(&24)) ); //a lot nodes reverted to previous version, however this won't impact things assert_eq!( @@ -1135,7 +1135,7 @@ mod tests { let counter = &drive_cache.protocol_versions_counter; assert_eq!( (counter.get(&1), counter.get(&TEST_PROTOCOL_VERSION_2)), - (Some(&22), Some(&3)) + (Some(&23), Some(&2)) ); assert_eq!( platform @@ -1289,7 +1289,7 @@ mod tests { counter.get(&TEST_PROTOCOL_VERSION_2), counter.get(&TEST_PROTOCOL_VERSION_3) ), - (Some(&2), Some(&69), Some(&3)) + (Some(&2), Some(&68), Some(&3)) ); //some nodes reverted to previous version } @@ -1343,7 +1343,7 @@ mod tests { ChainExecutionParameters { block_start, core_height_start: 1, - block_count: 700, + block_count: 1100, proposers, quorums, current_quorum_hash, @@ -1369,7 +1369,7 @@ mod tests { .basic_info() .epoch .index, - 4 + 5 ); assert_eq!( platform @@ -1389,7 +1389,7 @@ mod tests { counter.get(&TEST_PROTOCOL_VERSION_2), counter.get(&TEST_PROTOCOL_VERSION_3) ), - (None, Some(&3), Some(&155)) + (None, Some(&3), Some(&143)) ); } }) From 7ed516a8ae45b73cfb64a1a33235d4cc86fffb0b Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sun, 21 Jan 2024 11:19:14 -0800 Subject: [PATCH 24/51] made improvements to chain lock verification --- .../update_quorum_info/v0/mod.rs | 4 +- .../verify_chain_lock_locally/v0/mod.rs | 79 ++++++++++++++++--- .../src/platform_types/platform_state/mod.rs | 15 ++-- .../platform_types/platform_state/v0/mod.rs | 36 ++++++--- 4 files changed, 101 insertions(+), 33 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index b70b587ec70..bbee87b7f93 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -52,7 +52,9 @@ where return Ok(()); // no need to do anything } - // We should request the quorum list from 8 blocks behind the core block height + // We request the quorum list from the current core block height, this is because we also keep + // the previous chain lock validating quorum. Core will sign from 8 blocks before the current + // core block height, so often we will use the previous chain lock validating quorums instead. let mut extended_quorum_list = self .core_rpc diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index dea9adc12b6..56614fc4d10 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -50,18 +50,41 @@ where return Ok(None); // the chain lock is too far in the future or the past to verify locally } - let quorums = if let Some((previous_quorum_height, previous_quorums)) = - platform_state.previous_height_chain_lock_validating_quorums() - { - if chain_lock_height > 8 && chain_lock_height - 8 <= *previous_quorum_height { - // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock - previous_quorums + let (probable_quorums, second_to_check_quorums) = + if let Some((previous_quorum_height, change_quorum_height, previous_quorums)) = + platform_state.previous_height_chain_lock_validating_quorums() + { + if chain_lock_height > 8 && chain_lock_height - 8 >= *change_quorum_height { + // in this case we are sure that we should be targeting the current quorum + // We updated core chain lock height from 100 to 105, new chain lock comes in for block 114 + // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 106 (new chain lock verification height 114 - 8) + // We are sure that we should use current quorums + // If we have + // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 105 (new chain lock verification height 113 - 8) + // We should also use current quorums, this is because at 105 we are sure new chain lock validating quorums are active + (platform_state.chain_lock_validating_quorums(), None) + } else if chain_lock_height > 8 && chain_lock_height - 8 <= *previous_quorum_height + { + // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock + // We updated core chain lock height from 100 to 105, new chain lock comes in for block 106 + // -------- 98 (new chain lock verification height 106 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) + // We are sure that we should use previous quorums + // If we have + // -------- 100 (new chain lock verification height 108 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) + // We should also use previous quorums, this is because at 100 we are sure the old quorum set was active + (previous_quorums, None) + } else { + // we are in between, so we don't actually know if it was the old one or the new one to be used. + // ------- 100 (previous_quorum_height) ------ 104 (new chain lock verification height 112 - 8) -------105 (change_quorum_height) + // we should just try both, starting with the current quorums + ( + platform_state.chain_lock_validating_quorums(), + Some(previous_quorums), + ) + } } else { - platform_state.chain_lock_validating_quorums() - } - } else { - platform_state.chain_lock_validating_quorums() - }; + (platform_state.chain_lock_validating_quorums(), None) + }; // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. @@ -83,7 +106,7 @@ where let quorum = Platform::::choose_quorum( self.config.chain_lock_quorum_type(), - quorums, + probable_quorums, request_id.as_ref(), platform_version, )?; @@ -103,7 +126,37 @@ where let message_digest = sha256d::Hash::from_engine(engine); - let chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + + if !chain_lock_verified { + // We should also check the other quorum, as there could be the situation where the core height wasn't updated every block. + if let Some(second_to_check_quorums) = second_to_check_quorums { + let quorum = Platform::::choose_quorum( + self.config.chain_lock_quorum_type(), + second_to_check_quorums, + request_id.as_ref(), + platform_version, + )?; + + let Some((quorum_hash, public_key)) = quorum else { + // we return that we are not able to verify + return Ok(None); + }; + + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[self.config.chain_lock_quorum_type() as u8]); + engine.input(quorum_hash.as_byte_array()); + engine.input(request_id.as_byte_array()); + engine.input(chain_lock.block_hash.as_byte_array()); + + let message_digest = sha256d::Hash::from_engine(engine); + + chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + } + } return Ok(Some(chain_lock_verified)); } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index cecb9e0acc3..14a1e81f5e5 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -417,13 +417,16 @@ impl PlatformStateV0Methods for PlatformState { fn set_previous_chain_lock_validating_quorums( &mut self, - core_height: u32, + previous_core_height: u32, + change_core_height: u32, quorums: BTreeMap, ) { match self { - PlatformState::V0(v0) => { - v0.set_previous_chain_lock_validating_quorums(core_height, quorums) - } + PlatformState::V0(v0) => v0.set_previous_chain_lock_validating_quorums( + previous_core_height, + change_core_height, + quorums, + ), } } @@ -491,7 +494,7 @@ impl PlatformStateV0Methods for PlatformState { fn previous_height_chain_lock_validating_quorums( &self, - ) -> Option<&(u32, BTreeMap)> { + ) -> Option<&(u32, u32, BTreeMap)> { match self { PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums(), } @@ -499,7 +502,7 @@ impl PlatformStateV0Methods for PlatformState { fn previous_height_chain_lock_validating_quorums_mut( &mut self, - ) -> &mut Option<(u32, BTreeMap)> { + ) -> &mut Option<(u32, u32, BTreeMap)> { match self { PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums_mut(), } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index 3d2414fab11..31edee36f84 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -43,14 +43,19 @@ pub struct PlatformStateV0 { /// all members pub validator_sets: IndexMap, - /// The current 400 60 quorums used for validating chain locks + /// The current quorums used for validating chain locks (400 60 for mainnet) pub chain_lock_validating_quorums: BTreeMap, - /// The slightly old 400 60 quorums used for validating chain locks, it's important to keep + /// The slightly old quorums used for validating chain locks, it's important to keep /// these because validation of signatures happens for the quorums that are 8 blocks before the - /// height written in the chain lock + /// height written in the chain lock (400 60 for mainnet) + /// The first u32 is the core height at which these chain lock validating quorums were last active + /// The second u32 is the core height we are changing at. + /// Keeping both is important for verifying the chain locks, as we can detect edge cases where we + /// must check a chain lock with both the previous height chain lock validating quorums and the + /// current ones pub previous_height_chain_lock_validating_quorums: - Option<(u32, BTreeMap)>, + Option<(u32, u32, BTreeMap)>, /// current full masternode list pub full_masternode_list: BTreeMap, @@ -126,10 +131,10 @@ pub(super) struct PlatformStateForSavingV0 { #[bincode(with_serde)] pub chain_lock_validating_quorums: Vec<(Bytes32, ThresholdBlsPublicKey)>, - /// The 400 60 quorums used for validating chain locks from a slightly previous height. + /// The quorums used for validating chain locks from a slightly previous height. #[bincode(with_serde)] pub previous_height_chain_lock_validating_quorums: - Option<(u32, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, + Option<(u32, u32, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, /// current full masternode list pub full_masternode_list: BTreeMap, @@ -167,9 +172,10 @@ impl TryFrom for PlatformStateForSavingV0 { .collect(), previous_height_chain_lock_validating_quorums: value .previous_height_chain_lock_validating_quorums - .map(|(previous_height, inner_value)| { + .map(|(previous_height, change_height, inner_value)| { ( previous_height, + change_height, inner_value .into_iter() .map(|(k, v)| (k.to_byte_array().into(), v)) @@ -225,9 +231,10 @@ impl From for PlatformStateV0 { .collect(), previous_height_chain_lock_validating_quorums: value .previous_height_chain_lock_validating_quorums - .map(|(previous_height, inner_value)| { + .map(|(previous_height, change_height, inner_value)| { ( previous_height, + change_height, inner_value .into_iter() .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) @@ -366,7 +373,8 @@ pub trait PlatformStateV0Methods { /// Sets the previous chain lock validating quorums. fn set_previous_chain_lock_validating_quorums( &mut self, - core_height: u32, + previous_core_height: u32, + change_core_height: u32, quorums: BTreeMap, ); @@ -653,10 +661,12 @@ impl PlatformStateV0Methods for PlatformStateV0 { /// Sets the previous chain lock validating quorums. fn set_previous_chain_lock_validating_quorums( &mut self, - core_height: u32, + previous_core_height: u32, + change_core_height: u32, quorums: BTreeMap, ) { - self.previous_height_chain_lock_validating_quorums = Some((core_height, quorums)); + self.previous_height_chain_lock_validating_quorums = + Some((previous_core_height, change_core_height, quorums)); } /// Sets the full masternode list. @@ -706,13 +716,13 @@ impl PlatformStateV0Methods for PlatformStateV0 { fn previous_height_chain_lock_validating_quorums( &self, - ) -> Option<&(u32, BTreeMap)> { + ) -> Option<&(u32, u32, BTreeMap)> { self.previous_height_chain_lock_validating_quorums.as_ref() } fn previous_height_chain_lock_validating_quorums_mut( &mut self, - ) -> &mut Option<(u32, BTreeMap)> { + ) -> &mut Option<(u32, u32, BTreeMap)> { &mut self.previous_height_chain_lock_validating_quorums } From 2193f7ac0d51d6ee4f40563fd187f24b2f8dd55f Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Tue, 23 Jan 2024 03:12:36 -0800 Subject: [PATCH 25/51] chain lock fixes --- Cargo.lock | 214 +++++++++--------- .../engine/run_block_proposal/v0/mod.rs | 26 +-- .../update_quorum_info/v0/mod.rs | 2 + .../mod.rs | 12 +- .../v0/mod.rs | 15 +- .../verify_chain_lock/v0/mod.rs | 129 +++++++++-- .../verify_chain_lock_through_core/mod.rs | 3 +- .../verify_chain_lock_through_core/v0/mod.rs | 17 +- .../platform_types/platform_state/v0/mod.rs | 4 +- .../verify_chain_lock_result/v0/mod.rs | 4 +- packages/rs-drive-abci/src/rpc/core.rs | 4 +- .../tests/strategy_tests/execution.rs | 2 +- 12 files changed, 273 insertions(+), 159 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3912ce84859..f2719861f6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,9 +67,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -296,9 +296,9 @@ checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -401,9 +401,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -462,9 +462,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ "borsh-derive", "cfg_aliases", @@ -472,12 +472,12 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", - "proc-macro-crate 2.0.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.48", @@ -629,9 +629,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -639,7 +639,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -690,9 +690,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.13" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -700,9 +700,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -844,44 +844,37 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -1025,11 +1018,11 @@ source = "git+https://github.com/dashpay/rust-dashcore?branch=master#35a166e7625 [[package]] name = "dashcore-rpc" version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#d62d3628f83efa7fba00d3c3c9e21ed87d4381ab" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#d7df63efcd59815bb9a5bbc05d6c82dfc24df2c6" dependencies = [ "dashcore-private", "dashcore-rpc-json", - "env_logger 0.10.1", + "env_logger 0.10.2", "hex", "jsonrpc", "log", @@ -1040,7 +1033,7 @@ dependencies = [ [[package]] name = "dashcore-rpc-json" version = "0.15.1" -source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#d62d3628f83efa7fba00d3c3c9e21ed87d4381ab" +source = "git+https://github.com/dashpay/rust-dashcore-rpc?branch=master#d7df63efcd59815bb9a5bbc05d6c82dfc24df2c6" dependencies = [ "bincode 2.0.0-rc.3", "dashcore", @@ -1224,7 +1217,7 @@ name = "drive" version = "1.0.0-dev.2" dependencies = [ "anyhow", - "base64 0.21.5", + "base64 0.21.7", "bs58 0.5.0", "byteorder", "chrono", @@ -1265,7 +1258,7 @@ dependencies = [ "bytes", "chrono", "ciborium", - "clap 4.4.13", + "clap 4.4.18", "dapi-grpc", "dashcore-rpc", "delegate", @@ -1293,7 +1286,7 @@ dependencies = [ "rust_decimal_macros", "serde", "serde_json", - "serde_with 3.4.0", + "serde_with 3.5.0", "sha2", "simple-signer", "strategy-tests", @@ -1411,9 +1404,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -1726,9 +1719,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -1840,9 +1833,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -1904,9 +1897,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2105,7 +2098,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.4", "libc", "windows-sys 0.48.0", ] @@ -2122,8 +2115,8 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ - "hermit-abi 0.3.3", - "rustix 0.38.28", + "hermit-abi 0.3.4", + "rustix 0.38.30", "windows-sys 0.52.0", ] @@ -2239,7 +2232,7 @@ source = "git+https://github.com/fominok/jsonschema-rs?branch=feat-unevaluated-p dependencies = [ "ahash 0.7.7", "anyhow", - "base64 0.21.5", + "base64 0.21.7", "bytecount", "fancy-regex", "fraction", @@ -2278,9 +2271,9 @@ checksum = "744a4c881f502e98c2241d2e5f50040ac73b30194d64452bb6260393b53f0dc9" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libloading" @@ -2310,9 +2303,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "295c17e837573c8c821dbaeb3cceb3d745ad082f7572191409e69cbc1b3fd050" dependencies = [ "cc", "pkg-config", @@ -2327,9 +2320,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -2412,7 +2405,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "hyper", "indexmap 1.9.3", "ipnet", @@ -2531,7 +2524,7 @@ dependencies = [ "tagptr", "thiserror", "triomphe", - "uuid 1.6.1", + "uuid 1.7.0", ] [[package]] @@ -2672,7 +2665,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.4", "libc", ] @@ -2831,9 +2824,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" @@ -3038,12 +3031,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.21.0", ] [[package]] @@ -3072,9 +3064,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -3290,9 +3282,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -3300,9 +3292,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3319,13 +3311,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -3340,9 +3332,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", @@ -3408,7 +3400,7 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid 1.6.1", + "uuid 1.7.0", ] [[package]] @@ -3457,7 +3449,7 @@ name = "rs-sdk" version = "1.0.0-dev.2" dependencies = [ "async-trait", - "base64 0.21.5", + "base64 0.21.7", "bincode 2.0.0-rc.3", "ciborium", "dapi-grpc", @@ -3557,14 +3549,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -3598,7 +3590,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -3815,16 +3807,16 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "f58c3a1b3e418f61c25b2aeb43fc6c95eaa252b8cecdda67f401943e9e08d33f" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "serde", "serde_json", - "serde_with_macros 3.4.0", + "serde_with_macros 3.5.0", "time", ] @@ -3842,9 +3834,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "d2068b437a31fc68f25dd7edc296b078f04b45145c199d8eed9866e45f1ff274" dependencies = [ "darling", "proc-macro2", @@ -3874,9 +3866,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -3944,9 +3936,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -4124,7 +4116,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", - "rustix 0.38.28", + "rustix 0.38.30", "windows-sys 0.52.0", ] @@ -4146,7 +4138,7 @@ dependencies = [ "tracing", "tracing-subscriber", "url", - "uuid 1.6.1", + "uuid 1.7.0", ] [[package]] @@ -4183,9 +4175,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -4401,9 +4393,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" [[package]] name = "toml_edit" @@ -4418,9 +4410,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.1.0", "toml_datetime", @@ -4436,7 +4428,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.5", + "base64 0.21.7", "bytes", "futures-core", "futures-util", @@ -4622,9 +4614,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -4677,7 +4669,7 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "flate2", "log", "once_cell", @@ -4712,9 +4704,9 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", "rand", @@ -4905,7 +4897,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.28", + "rustix 0.38.30", ] [[package]] @@ -5082,9 +5074,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.32" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 22e360789ed..d1ea5432dc1 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -139,8 +139,8 @@ where let VerifyChainLockResult { chain_lock_signature_is_deserializable, found_valid_locally, - submitted, found_valid_by_core, + core_is_synced, } = match verification_result { Ok(verification_result) => verification_result, Err(Error::Execution(e)) => { @@ -179,13 +179,13 @@ where } } - if let Some(submission_accepted_by_core) = submitted { - // This means we are able to check if the chain lock is valid - if !submission_accepted_by_core { - // The submission was not accepted by core + if let Some(found_valid_by_core) = found_valid_by_core { + // This means we asked core if the chain lock was valid + if !found_valid_by_core { + // Core said it wasn't valid return Ok(ValidationResult::new_with_error( - AbciError::ChainLockedBlockNotKnownByCore(format!( - "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", + AbciError::InvalidChainLock(format!( + "received a chain lock for height {} that is invalid based on a core request {:?}", block_info.height, core_chain_lock_update, )) .into(), @@ -193,13 +193,13 @@ where } } - if let Some(found_valid_by_core) = found_valid_by_core { - // This means we asked core if the chain lock was valid - if !found_valid_by_core { - // Core said it wasn't valid + if let Some(core_is_synced) = core_is_synced { + // Core is just not synced + if !core_is_synced { + // The submission was not accepted by core return Ok(ValidationResult::new_with_error( - AbciError::InvalidChainLock(format!( - "received a chain lock for height {} that is invalid based on a core request {:?}", + AbciError::ChainLockedBlockNotKnownByCore(format!( + "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", block_info.height, core_chain_lock_update, )) .into(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index bbee87b7f93..c4686c912df 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -188,6 +188,7 @@ where tracing::trace!("updated chain lock validating quorums to current validator set",); block_platform_state.set_previous_chain_lock_validating_quorums( block_platform_state.last_committed_core_height(), + core_block_height, previous_quorums, ); } @@ -276,6 +277,7 @@ where old_state.chain_lock_validating_quorums().clone(); block_platform_state.set_previous_chain_lock_validating_quorums( block_platform_state.last_committed_core_height(), + core_block_height, previous_chain_lock_validating_quorums, ); } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs index 9c34b261a65..086d74ba839 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -8,6 +8,16 @@ use dpp::version::PlatformVersion; /// Version 0 pub mod v0; +/// As we ask to make sure that core is synced to the chain lock, we get back one of 3 +pub enum CoreSyncStatus { + /// Core is synced + CoreIsSynced, + /// Core is 1 or 2 blocks off, we should retry shortly + CoreAlmostSynced, + /// Core is more than 2 blocks off + CoreNotSynced, +} + impl Platform where C: CoreRPCLike, @@ -26,7 +36,7 @@ where &self, chain_lock: &ChainLock, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result { match platform_version .drive_abci .methods diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs index 89c8d02d7ae..5c5bc1a63b4 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -2,7 +2,8 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore::ChainLock; -use dpp::version::PlatformVersion; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus::{CoreIsSynced, CoreAlmostSynced, CoreNotSynced}; impl Platform where @@ -13,8 +14,16 @@ where pub(super) fn make_sure_core_is_synced_to_chain_lock_v0( &self, chain_lock: &ChainLock, - ) -> Result { + ) -> Result { + let given_chain_lock_height = chain_lock.block_height; // We need to make sure core is synced to the core height we see as valid for the state transitions - Ok(self.core_rpc.submit_chain_lock(chain_lock)?) + let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; + Ok(if best_chain_locked_height >= given_chain_lock_height { + CoreIsSynced + } else if best_chain_locked_height - given_chain_lock_height < 3 { + CoreAlmostSynced + } else { + CoreNotSynced + }) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index b4291e2d045..bed329e0de2 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -1,11 +1,12 @@ -use crate::config::PlatformConfig; +use std::thread::sleep; +use std::time::Duration; use crate::error::Error; use crate::execution::platform_events::core_chain_lock::verify_chain_lock::VerifyChainLockResult; use dpp::dashcore::ChainLock; use dpp::version::PlatformVersion; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; use crate::platform_types::platform::Platform; -use crate::platform_types::platform_state::v0::PlatformStateV0Methods; use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; @@ -25,44 +26,132 @@ where match self.verify_chain_lock_locally(platform_state, chain_lock, platform_version) { Ok(Some(valid)) => { if valid && make_sure_core_is_synced { - //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result - let submission_result = - self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version)?; - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: Some(valid), - submitted: Some(submission_result), - found_valid_by_core: None, - }) + match self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version) { + Ok(sync_status) => { + match sync_status { + CoreSyncStatus::CoreIsSynced => { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: None, + core_is_synced: Some(true), + }) + } + CoreSyncStatus::CoreAlmostSynced => { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(200)); + let best_chain_locked = self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height < chain_lock.block_height { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }) + } + } + CoreSyncStatus::CoreNotSynced => { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } + } + } + Err(Error::CoreRpc(..)) => { + //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(false), + core_is_synced: None, //we do not know + }) + } + Err(e) => { + Err(e) + } + } } else { Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, found_valid_locally: Some(valid), - submitted: None, found_valid_by_core: None, + core_is_synced: None, }) } } Ok(None) => { - let verified = self.verify_chain_lock_through_core( + // we were not able to verify locally + let (verified, status) = self.verify_chain_lock_through_core( chain_lock, make_sure_core_is_synced, platform_version, )?; - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: None, - submitted: None, - found_valid_by_core: Some(verified), - }) + if let Some(sync_status) = status { + // if we had make_sure_core_is_synced set to true + match sync_status { + CoreSyncStatus::CoreIsSynced => { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: None, + core_is_synced: Some(true), + }) + } + CoreSyncStatus::CoreAlmostSynced => { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(200)); + let best_chain_locked = self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height < chain_lock.block_height { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }) + } + } + CoreSyncStatus::CoreNotSynced => { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) + } + } + } else { + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(verified), + core_is_synced: None, + }) + } } Err(Error::BLSError(_)) => Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: false, found_valid_locally: None, - submitted: None, found_valid_by_core: None, + core_is_synced: None, }), Err(e) => Err(e), } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs index 972d85b7045..7112377c9c9 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -9,6 +9,7 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; impl Platform where @@ -20,7 +21,7 @@ where chain_lock: &ChainLock, submit: bool, platform_version: &PlatformVersion, - ) -> Result { + ) -> Result<(bool, Option), Error> { match platform_version .drive_abci .methods diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs index 7baef2dc125..ccc9fb1fddc 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -1,5 +1,7 @@ use crate::error::Error; use dpp::dashcore::ChainLock; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus::{CoreAlmostSynced, CoreIsSynced, CoreNotSynced}; use crate::platform_types::platform::Platform; @@ -14,11 +16,20 @@ where &self, chain_lock: &ChainLock, submit: bool, - ) -> Result { + ) -> Result<(bool, Option), Error> { if submit { - Ok(self.core_rpc.submit_chain_lock(chain_lock)?) + let given_chain_lock_height = chain_lock.block_height; + + let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; + Ok(if best_chain_locked_height >= given_chain_lock_height { + (true, Some(CoreIsSynced)) + } else if best_chain_locked_height - given_chain_lock_height < 3 { + (true, Some(CoreAlmostSynced)) + } else { + (true, Some(CoreNotSynced)) + }) } else { - Ok(self.core_rpc.verify_chain_lock(chain_lock)?) + Ok((self.core_rpc.verify_chain_lock(chain_lock)?, None)) } } } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index 31edee36f84..093b97dad4f 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -412,7 +412,7 @@ pub trait PlatformStateV0Methods { /// Returns a mutable reference to the previous chain lock validating quorums. fn previous_height_chain_lock_validating_quorums_mut( &mut self, - ) -> &mut Option<(u32, BTreeMap)>; + ) -> &mut Option<(u32, u32, BTreeMap)>; /// Returns a mutable reference to the full masternode list. fn full_masternode_list_mut(&mut self) -> &mut BTreeMap; @@ -428,7 +428,7 @@ pub trait PlatformStateV0Methods { /// The previous height chain lock validating quorums fn previous_height_chain_lock_validating_quorums( &self, - ) -> Option<&(u32, BTreeMap)>; + ) -> Option<&(u32, u32, BTreeMap)>; } impl PlatformStateV0Methods for PlatformStateV0 { diff --git a/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs index 6e11fdd1483..57d0293ba8b 100644 --- a/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/verify_chain_lock_result/v0/mod.rs @@ -4,9 +4,9 @@ pub struct VerifyChainLockResult { pub(crate) chain_lock_signature_is_deserializable: bool, /// If the chain lock was found to be valid based on platform state pub(crate) found_valid_locally: Option, - /// If we were able to stable to submit the chain lock to core and it is valid there - pub(crate) submitted: Option, /// If we were not able to validate based on platform state - ie the chain lock is too far in /// the future pub(crate) found_valid_by_core: Option, + /// Core is synced + pub(crate) core_is_synced: Option, } diff --git a/packages/rs-drive-abci/src/rpc/core.rs b/packages/rs-drive-abci/src/rpc/core.rs index f875d2f46b0..941459325f5 100644 --- a/packages/rs-drive-abci/src/rpc/core.rs +++ b/packages/rs-drive-abci/src/rpc/core.rs @@ -28,7 +28,7 @@ pub trait CoreRPCLike { fn get_best_chain_lock(&self) -> Result; /// Submit a chain lock - fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result; + fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result; /// Get transaction fn get_transaction(&self, tx_id: &Txid) -> Result; @@ -203,7 +203,7 @@ impl CoreRPCLike for DefaultCoreRPC { retry!(self.inner.get_best_chain_lock()) } - fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result { + fn submit_chain_lock(&self, chain_lock: &ChainLock) -> Result { retry!(self.inner.submit_chain_lock(chain_lock)) } diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index 7ff05ee57e0..743e2320e15 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -651,7 +651,7 @@ pub(crate) fn run_chain_for_strategy( platform .core_rpc .expect_submit_chain_lock() - .returning(move |chain_lock: &ChainLock| return Ok(true)); + .returning(move |chain_lock: &ChainLock| return Ok(chain_lock.block_height)); create_chain_for_strategy( platform, From 5a2e4526944b0917b4df15a59de8b6cbb6de2c6c Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Tue, 23 Jan 2024 03:12:51 -0800 Subject: [PATCH 26/51] fmt --- .../verify_chain_lock/v0/mod.rs | 108 ++++++++---------- .../verify_chain_lock_through_core/mod.rs | 2 +- 2 files changed, 50 insertions(+), 60 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index bed329e0de2..e80238615e8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -1,10 +1,10 @@ -use std::thread::sleep; -use std::time::Duration; use crate::error::Error; +use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; use crate::execution::platform_events::core_chain_lock::verify_chain_lock::VerifyChainLockResult; use dpp::dashcore::ChainLock; use dpp::version::PlatformVersion; -use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use std::thread::sleep; +use std::time::Duration; use crate::platform_types::platform::Platform; use crate::platform_types::platform_state::PlatformState; @@ -26,61 +26,55 @@ where match self.verify_chain_lock_locally(platform_state, chain_lock, platform_version) { Ok(Some(valid)) => { if valid && make_sure_core_is_synced { - - match self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version) { - Ok(sync_status) => { - match sync_status { - CoreSyncStatus::CoreIsSynced => { + match self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version) + { + Ok(sync_status) => { + match sync_status { + CoreSyncStatus::CoreIsSynced => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: None, + core_is_synced: Some(true), + }), + CoreSyncStatus::CoreAlmostSynced => { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(200)); + let best_chain_locked = self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height < chain_lock.block_height { Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, found_valid_locally: Some(true), - found_valid_by_core: None, - core_is_synced: Some(true), + found_valid_by_core: Some(true), + core_is_synced: Some(false), }) - } - CoreSyncStatus::CoreAlmostSynced => { - // The chain lock is valid we just need to sleep a bit and retry - sleep(Duration::from_millis(200)); - let best_chain_locked = self.core_rpc.get_best_chain_lock()?; - if best_chain_locked.block_height < chain_lock.block_height { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: Some(true), - found_valid_by_core: Some(true), - core_is_synced: Some(false), - }) - } else { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: Some(valid), - found_valid_by_core: Some(true), - core_is_synced: Some(true), - }) - } - } - CoreSyncStatus::CoreNotSynced => { + } else { Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, found_valid_locally: Some(valid), found_valid_by_core: Some(true), - core_is_synced: Some(false), + core_is_synced: Some(true), }) } } - } - Err(Error::CoreRpc(..)) => { - //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result - Ok(VerifyChainLockResult { + CoreSyncStatus::CoreNotSynced => Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, found_valid_locally: Some(valid), - found_valid_by_core: Some(false), - core_is_synced: None, //we do not know - }) - } - Err(e) => { - Err(e) + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }), } } + Err(Error::CoreRpc(..)) => { + //ToDO (important), separate errors from core, connection Errors -> Err, others should be part of the result + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(false), + core_is_synced: None, //we do not know + }) + } + Err(e) => Err(e), + } } else { Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, @@ -101,14 +95,12 @@ where if let Some(sync_status) = status { // if we had make_sure_core_is_synced set to true match sync_status { - CoreSyncStatus::CoreIsSynced => { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: None, - found_valid_by_core: None, - core_is_synced: Some(true), - }) - } + CoreSyncStatus::CoreIsSynced => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: None, + core_is_synced: Some(true), + }), CoreSyncStatus::CoreAlmostSynced => { // The chain lock is valid we just need to sleep a bit and retry sleep(Duration::from_millis(200)); @@ -129,14 +121,12 @@ where }) } } - CoreSyncStatus::CoreNotSynced => { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: None, - found_valid_by_core: Some(true), - core_is_synced: Some(false), - }) - } + CoreSyncStatus::CoreNotSynced => Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }), } } else { Ok(VerifyChainLockResult { diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs index 7112377c9c9..a1750c22b93 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -8,8 +8,8 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; -use dpp::version::PlatformVersion; use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; +use dpp::version::PlatformVersion; impl Platform where From 259fe7906e94802b29aaf5a6b86de2cae9220dee Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Tue, 23 Jan 2024 03:15:29 -0800 Subject: [PATCH 27/51] extra info --- .../core_based_updates/update_quorum_info/v0/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index c4686c912df..e2d38278f05 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -239,7 +239,7 @@ where let added_a_chain_lock_validating_quorum = !quorum_infos.is_empty(); if added_a_chain_lock_validating_quorum { - // Map to validator sets + // Map to chain lock validating quorums let new_chain_lock_quorums = quorum_infos .into_iter() .map(|(quorum_hash, info_result)| { From c58ebd39b7e94a1cc07b4a83a267dbdb4b984ae0 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Tue, 23 Jan 2024 22:33:21 +0700 Subject: [PATCH 28/51] chore(dashmate): add CHAIN_LOCK_QUORUM_SIZE to dashmate --- packages/dashmate/configs/defaults/getBaseConfigFactory.js | 1 + packages/dashmate/configs/defaults/getLocalConfigFactory.js | 1 + .../dashmate/configs/defaults/getTestnetConfigFactory.js | 1 + packages/dashmate/docker-compose.yml | 1 + packages/dashmate/src/config/configJsonSchema.js | 6 +++++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/dashmate/configs/defaults/getBaseConfigFactory.js b/packages/dashmate/configs/defaults/getBaseConfigFactory.js index 289eb2fe53c..e7d67da2552 100644 --- a/packages/dashmate/configs/defaults/getBaseConfigFactory.js +++ b/packages/dashmate/configs/defaults/getBaseConfigFactory.js @@ -171,6 +171,7 @@ export default function getBaseConfigFactory(homeDir) { chainLock: { llmqType: 2, dkgInterval: 288, + llmqSize: 400, }, epochTime: 788400, }, diff --git a/packages/dashmate/configs/defaults/getLocalConfigFactory.js b/packages/dashmate/configs/defaults/getLocalConfigFactory.js index 84253277c0b..b5462511965 100644 --- a/packages/dashmate/configs/defaults/getLocalConfigFactory.js +++ b/packages/dashmate/configs/defaults/getLocalConfigFactory.js @@ -71,6 +71,7 @@ export default function getLocalConfigFactory(getBaseConfig) { chainLock: { llmqType: 100, dkgInterval: 24, + llmqSize: 3, }, }, }, diff --git a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js index ebd971074de..83bdb95383c 100644 --- a/packages/dashmate/configs/defaults/getTestnetConfigFactory.js +++ b/packages/dashmate/configs/defaults/getTestnetConfigFactory.js @@ -56,6 +56,7 @@ export default function getTestnetConfigFactory(homeDir, getBaseConfig) { chainLock: { llmqType: 1, dkgInterval: 24, + llmqSize: 50, }, }, tenderdash: { diff --git a/packages/dashmate/docker-compose.yml b/packages/dashmate/docker-compose.yml index 054099c5d35..d5edfc86ffe 100644 --- a/packages/dashmate/docker-compose.yml +++ b/packages/dashmate/docker-compose.yml @@ -66,6 +66,7 @@ services: - VALIDATOR_SET_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_VALIDATOR_SET_LLMQ_TYPE:?err} - CHAIN_LOCK_QUORUM_TYPE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_TYPE:?err} - CHAIN_LOCK_QUORUM_WINDOW=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_DKG_INTERVAL:?err} + - CHAIN_LOCK_QUORUM_SIZE=${PLATFORM_DRIVE_ABCI_CHAIN_LOCK_LLMQ_SIZE:?err} stop_grace_period: 30s env_file: # Logger settings diff --git a/packages/dashmate/src/config/configJsonSchema.js b/packages/dashmate/src/config/configJsonSchema.js index 8d2c5e7c58d..3892fc6fe0b 100644 --- a/packages/dashmate/src/config/configJsonSchema.js +++ b/packages/dashmate/src/config/configJsonSchema.js @@ -533,13 +533,17 @@ export default { // https://github.com/dashpay/dashcore-lib/blob/843176fed9fc81feae43ccf319d99e2dd942fe1f/lib/constants/index.js#L50-L99 enum: [1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 106, 107], }, + llmqSize: { + type: 'integer', + minimum: 0, + }, dkgInterval: { type: 'integer', minimum: 0, }, }, additionalProperties: false, - required: ['llmqType', 'dkgInterval'], + required: ['llmqType', 'llmqSize', 'dkgInterval'], }, epochTime: { type: 'integer', From 681515018e5cab720b08abe6894782797bb68613 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Tue, 23 Jan 2024 16:08:28 -0800 Subject: [PATCH 29/51] added some unit tests --- .../verify_chain_lock_locally/v0/mod.rs | 81 +++++++++++++++++-- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 56614fc4d10..502deffef6d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -91,12 +91,7 @@ where let mut engine = QuorumSigningRequestId::engine(); - // Prefix - let prefix_len = VarInt(CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u64); - prefix_len - .consensus_encode(&mut engine) - .expect("expected to encode the prefix"); - + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); engine.input(chain_lock.block_height.to_le_bytes().as_slice()); @@ -161,3 +156,77 @@ where return Ok(Some(chain_lock_verified)); } } + +#[cfg(test)] +mod tests { + use crate::execution::platform_events::core_chain_lock::verify_chain_lock_locally::v0::CHAIN_LOCK_REQUEST_ID_PREFIX; + use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; + use dpp::dashcore::QuorumSigningRequestId; + + #[test] + fn verify_request_id() { + assert_eq!( + hex::encode(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()), + "636c736967" + ); + assert_eq!(hex::encode(122u32.to_le_bytes()), "7a000000"); + + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(122u32.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + assert_eq!( + hex::encode(request_id.as_byte_array()), + "e1a9d40e5145fdc168819125b5ae1b8f12d5115471624eb363a6c7a3693be2e6" + ); + + // + // let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + } + + #[test] + fn verify_message_digest() { + let mut engine = QuorumSigningRequestId::engine(); + + engine.input(&[CHAIN_LOCK_REQUEST_ID_PREFIX.len() as u8]); + engine.input(CHAIN_LOCK_REQUEST_ID_PREFIX.as_bytes()); + engine.input(956087u32.to_le_bytes().as_slice()); + + let request_id = QuorumSigningRequestId::from_engine(engine); + + assert_eq!( + hex::encode(request_id.as_byte_array()), + "ea04b27adfaa698487aee46b922fb8f1c77a562787b6afe65eecf7e685888928" + ); + + let mut block_hash = + hex::decode("000000d94ea7ac4f86c5f583e7da0feb90b9f8d038f25e55cc305524c5327266") + .unwrap(); + let mut quorum_hash = + hex::decode("0000009d376e73a22aa997bb6542bd1fc3018f61c2301a817126a737ffdcdc80") + .unwrap(); + + block_hash.reverse(); + quorum_hash.reverse(); + + let mut engine = sha256d::Hash::engine(); + + engine.input(&[1u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.to_byte_array().as_slice()); + engine.input(block_hash.as_slice()); + + let mut message_digest = sha256d::Hash::from_engine(engine).as_byte_array().to_vec(); + + message_digest.reverse(); + + assert_eq!( + hex::encode(message_digest.as_slice()), + "5ec53e83b8ff390b970e28db21da5b8e45fbe3b69d9f11a2c39062769b1f5e47" + ); + } +} From 29c8d4ad1f8ffc83a62d937bbd1cefa8502e0564 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 03:42:51 -0800 Subject: [PATCH 30/51] fixed issue on reject --- packages/rs-drive-abci/src/abci/handler/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 37a497f1f9d..4313e74f718 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -535,6 +535,7 @@ where // This was an error running this proposal, tell tenderdash that the block isn't valid let response = ResponseProcessProposal { status: proto::response_process_proposal::ProposalStatus::Reject.into(), + app_hash: [0;32].to_vec(), // we must send 32 bytes ..Default::default() }; From 8c0f063ec9cd28e2d8f8571c4fe25583ef266df3 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 03:54:59 -0800 Subject: [PATCH 31/51] wait for core to sync improvement --- .../src/core/wait_for_core_to_sync/v0/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs b/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs index 47e8dbbc8dd..d1f79b1e55d 100644 --- a/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs +++ b/packages/rs-drive-abci/src/core/wait_for_core_to_sync/v0/mod.rs @@ -17,6 +17,14 @@ pub fn wait_for_core_to_sync_v0( tracing::info!(?core_rpc, "waiting for core rpc to start"); while !cancel.is_cancelled() { + let has_chain_locked = match core_rpc.get_best_chain_lock() { + Ok(_) => true, + Err(error) => { + tracing::warn!(?error, "cannot get best chain lock"); + false + } + }; + let mn_sync_status = match core_rpc.masternode_sync_status() { Ok(status) => status, Err(error) => { @@ -25,7 +33,7 @@ pub fn wait_for_core_to_sync_v0( } }; - if !mn_sync_status.is_synced || !mn_sync_status.is_blockchain_synced { + if !has_chain_locked || !mn_sync_status.is_synced || !mn_sync_status.is_blockchain_synced { std::thread::sleep(CORE_SYNC_STATUS_CHECK_TIMEOUT); tracing::info!("waiting for core to sync..."); From 4b9f252c9a11edf7806a7e4ba8382b729fc43782 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 03:55:07 -0800 Subject: [PATCH 32/51] wait for core to sync improvement --- packages/rs-drive-abci/src/abci/handler/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/abci/handler/mod.rs b/packages/rs-drive-abci/src/abci/handler/mod.rs index 4313e74f718..fc935446f65 100644 --- a/packages/rs-drive-abci/src/abci/handler/mod.rs +++ b/packages/rs-drive-abci/src/abci/handler/mod.rs @@ -535,7 +535,7 @@ where // This was an error running this proposal, tell tenderdash that the block isn't valid let response = ResponseProcessProposal { status: proto::response_process_proposal::ProposalStatus::Reject.into(), - app_hash: [0;32].to_vec(), // we must send 32 bytes + app_hash: [0; 32].to_vec(), // we must send 32 bytes ..Default::default() }; From 3a2c8b3c41413d7941fdda657bb5b94683a2ee59 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 05:19:11 -0800 Subject: [PATCH 33/51] added more logging --- .../engine/run_block_proposal/v0/mod.rs | 2 +- .../verify_chain_lock_locally/v0/mod.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index d1ea5432dc1..163d74708d4 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -199,7 +199,7 @@ where // The submission was not accepted by core return Ok(ValidationResult::new_with_error( AbciError::ChainLockedBlockNotKnownByCore(format!( - "received a chain lock for height {} that we figured out was invalid based on platform state {:?}", + "received a chain lock for height {} that we could not accept because core is not synced {:?}", block_info.height, core_chain_lock_update, )) .into(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 502deffef6d..4f69e5baee6 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -97,6 +97,13 @@ where let request_id = QuorumSigningRequestId::from_engine(engine); + tracing::trace!( + ?chain_lock, + "request id for chain lock at height {} is {}", + chain_lock.block_height, + hex::encode(request_id.as_byte_array()) + ); + // Based on the deterministic masternode list at the given height, a quorum must be selected that was active at the time this block was mined let quorum = Platform::::choose_quorum( @@ -121,6 +128,15 @@ where let message_digest = sha256d::Hash::from_engine(engine); + tracing::trace!( + ?chain_lock, + "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}", + chain_lock.block_height, + hex::encode(message_digest.as_byte_array()), + hex::encode(quorum_hash.as_byte_array()), + hex::encode(chain_lock.block_hash.as_byte_array()) + ); + let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); if !chain_lock_verified { From a4515c4fb63fe349172002571a1eb3f94fb2b90e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 06:08:36 -0800 Subject: [PATCH 34/51] trial --- .../verify_chain_lock_locally/v0/mod.rs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 4f69e5baee6..5a2f2f7d428 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -139,6 +139,49 @@ where let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + if !chain_lock_verified { + + let mut quorum_hash = quorum_hash.to_byte_array().to_vec(); + let mut request_id = request_id.to_byte_array().to_vec(); + let mut block_hash = chain_lock.block_hash.to_byte_array().to_vec(); + + for reverse_quorum_hash in 0..=1 { + for reverse_request_id in 0..=1 { + for reverse_block_hash in 0..=1 { + for reverse_output in 0..=1 { + if reverse_quorum_hash == 1 { + quorum_hash.reverse(); + } + if reverse_request_id == 1 { + request_id.reverse(); + } + if reverse_block_hash == 1 { + block_hash.reverse(); + } + let mut engine = sha256d::Hash::engine(); + + engine.input(&[self.config.chain_lock_quorum_type() as u8]); + engine.input(quorum_hash.as_slice()); + engine.input(request_id.as_slice()); + engine.input(block_hash.as_slice()); + + let message_digest = sha256d::Hash::from_engine(engine); + + let mut message_digest_vec = message_digest.as_byte_array().to_vec(); + + if reverse_output == 1{ + message_digest_vec.reverse(); + } + + let chain_lock_verified_b = public_key.verify(&signature, message_digest_vec.as_slice()); + + tracing::trace!("reverse_quorum_hash {}, reverse_request_id {}, reverse_block_hash {}, reverse_output {} gives chain lock verified {}", reverse_quorum_hash, reverse_request_id, reverse_block_hash, reverse_output, chain_lock_verified_b); + } + } + } + } + } + if !chain_lock_verified { // We should also check the other quorum, as there could be the situation where the core height wasn't updated every block. if let Some(second_to_check_quorums) = second_to_check_quorums { From 821c58eb1f3cb03237216c33dec63b7b6faa96f6 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 06:21:48 -0800 Subject: [PATCH 35/51] found the reversal --- .../verify_chain_lock_locally/v0/mod.rs | 56 ++++--------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 5a2f2f7d428..8b3182e095d 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -117,12 +117,17 @@ where return Ok(None); }; + let mut quorum_hash = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash.reverse(); + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. let mut engine = sha256d::Hash::engine(); engine.input(&[self.config.chain_lock_quorum_type() as u8]); - engine.input(quorum_hash.as_byte_array()); + engine.input(quorum_hash.as_slice()); engine.input(request_id.as_byte_array()); engine.input(chain_lock.block_hash.as_byte_array()); @@ -139,49 +144,6 @@ where let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); - if !chain_lock_verified { - - let mut quorum_hash = quorum_hash.to_byte_array().to_vec(); - let mut request_id = request_id.to_byte_array().to_vec(); - let mut block_hash = chain_lock.block_hash.to_byte_array().to_vec(); - - for reverse_quorum_hash in 0..=1 { - for reverse_request_id in 0..=1 { - for reverse_block_hash in 0..=1 { - for reverse_output in 0..=1 { - if reverse_quorum_hash == 1 { - quorum_hash.reverse(); - } - if reverse_request_id == 1 { - request_id.reverse(); - } - if reverse_block_hash == 1 { - block_hash.reverse(); - } - let mut engine = sha256d::Hash::engine(); - - engine.input(&[self.config.chain_lock_quorum_type() as u8]); - engine.input(quorum_hash.as_slice()); - engine.input(request_id.as_slice()); - engine.input(block_hash.as_slice()); - - let message_digest = sha256d::Hash::from_engine(engine); - - let mut message_digest_vec = message_digest.as_byte_array().to_vec(); - - if reverse_output == 1{ - message_digest_vec.reverse(); - } - - let chain_lock_verified_b = public_key.verify(&signature, message_digest_vec.as_slice()); - - tracing::trace!("reverse_quorum_hash {}, reverse_request_id {}, reverse_block_hash {}, reverse_output {} gives chain lock verified {}", reverse_quorum_hash, reverse_request_id, reverse_block_hash, reverse_output, chain_lock_verified_b); - } - } - } - } - } - if !chain_lock_verified { // We should also check the other quorum, as there could be the situation where the core height wasn't updated every block. if let Some(second_to_check_quorums) = second_to_check_quorums { @@ -197,12 +159,16 @@ where return Ok(None); }; + let mut quorum_hash = quorum_hash.to_byte_array().to_vec(); + + quorum_hash.reverse(); + // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. let mut engine = sha256d::Hash::engine(); engine.input(&[self.config.chain_lock_quorum_type() as u8]); - engine.input(quorum_hash.as_byte_array()); + engine.input(quorum_hash.as_slice()); engine.input(request_id.as_byte_array()); engine.input(chain_lock.block_hash.as_byte_array()); From e1cdea765244a4974b246ba2f4b96d07240b7c7e Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 06:27:41 -0800 Subject: [PATCH 36/51] fix --- .../core_chain_lock/verify_chain_lock_locally/v0/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 8b3182e095d..a0846b95b4a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -138,7 +138,7 @@ where "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}", chain_lock.block_height, hex::encode(message_digest.as_byte_array()), - hex::encode(quorum_hash.as_byte_array()), + hex::encode(quorum_hash.as_slice()), hex::encode(chain_lock.block_hash.as_byte_array()) ); From c94a544af1fa5d931feceab0d9125a60791982f8 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 06:49:29 -0800 Subject: [PATCH 37/51] better logging --- .../verify_chain_lock_locally/v0/mod.rs | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index a0846b95b4a..4a19e5c6c6c 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -133,17 +133,18 @@ where let message_digest = sha256d::Hash::from_engine(engine); + let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + tracing::trace!( ?chain_lock, - "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}", + "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), - hex::encode(chain_lock.block_hash.as_byte_array()) + hex::encode(chain_lock.block_hash.as_byte_array()), + if chain_lock_verified { "verified"} else {"not verified"} ); - let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); - if !chain_lock_verified { // We should also check the other quorum, as there could be the situation where the core height wasn't updated every block. if let Some(second_to_check_quorums) = second_to_check_quorums { @@ -175,6 +176,32 @@ where let message_digest = sha256d::Hash::from_engine(engine); chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); + + tracing::trace!( + ?chain_lock, + "tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + chain_lock.block_height, + hex::encode(message_digest.as_byte_array()), + hex::encode(quorum_hash.as_slice()), + hex::encode(chain_lock.block_hash.as_byte_array()), + if chain_lock_verified { "verified"} else {"not verified"} + ); + if !chain_lock_verified { + tracing::error!( + "chain lock was invalid for both recent and old chain lock quorums" + ); + } + } else if platform_state + .previous_height_chain_lock_validating_quorums() + .is_none() + { + // we don't have old quorums, this means our node is very new. + tracing::trace!( + "we had no previous quorums locally, we should validate through core", + ); + Ok(None) + } else { + tracing::error!("chain lock was invalid, and we deemed there was no reason to check old quorums"); } } From 7c5707557805e08ff4c2126ec0edd6dd96db9685 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 07:06:54 -0800 Subject: [PATCH 38/51] better logging --- .../core_chain_lock/verify_chain_lock_locally/v0/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 4a19e5c6c6c..4b0828f2561 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -199,7 +199,7 @@ where tracing::trace!( "we had no previous quorums locally, we should validate through core", ); - Ok(None) + return Ok(None); } else { tracing::error!("chain lock was invalid, and we deemed there was no reason to check old quorums"); } From 65988706f3c4489f8e3e6b7f43d87b5486b90841 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 12:02:09 -0800 Subject: [PATCH 39/51] updated to 1.0.0-pr1621.0 --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 39 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb03b941466..afe26e51af3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 9367ba41abe..35f208056b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 3d249a0e74e..95de9ae8926 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 5936b3fce84..e14138c4c7a 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 520e07d8857..d3073320394 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 982f6b9312d..98fedac2239 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 90a85daeae4..4548181486c 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index eddc62b2a02..c44566a5f8b 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index ea69f871c89..d8cc544bc98 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index b159d7d7e9a..d0da5616e66 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 9ca1fc9250c..bab00f06df6 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 4b1156421ae..ba7dc7fcb58 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 6443f17ec1f..832137f69e4 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index d7fc4fcabf7..f569a24638c 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 016df4eed22..aac25bdf6da 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 7567d81fa9d..1bfa1640343 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 1c5851b75b6..26c469466ec 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 29a0bc18512..5fa30eb13d6 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 940d19628c0..9b83ae4098b 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index d07d51f736b..3030a176f1b 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index ae68cf9d3e5..04d9c4a534c 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 198feae7275..f93c8fa41b9 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index f952233c4d7..517337f0ee0 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index ea9f1bf5658..01a683744c8 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 3b42107d9e7..bd6593f5a7f 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index a0cda6ef577..26da3317e09 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 01c46b7fbcf..eefe4608833 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 01efda71698..ab7ee36e0ff 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 85da3f10c0b..9692b664857 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index f27e33cca8b..0299f09ba5f 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 456e152e888..01a4557a7e7 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index fc197caa00a..b4fb5626d91 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 0712383f300..0e6c76e296c 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 66abcd42f99..8dfe2fdd1b2 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index f78a30a8a03..a52b141b0bb 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index fccb89012ee..d0bf720598c 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 7dd92cab9cc..125a87902c8 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index c0e4c43fa90..ac0c2953d19 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-dev.3" +version = "1.0.0-pr1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index b5b7b083c11..95de5b0ebb7 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-dev.3", + "version": "1.0.0-pr1621.0", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From c3d756e2cd2d2eae0e9c6709abfff30c89f965a5 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 12:07:57 -0800 Subject: [PATCH 40/51] fixed tag --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 39 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index afe26e51af3..d892d118a24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 35f208056b5..4e72c793bed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 95de9ae8926..39d7c3cad2b 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index e14138c4c7a..dd8a5d58f3d 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index d3073320394..e7628809230 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 98fedac2239..74a4478bc68 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 4548181486c..92f5ef353e1 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index c44566a5f8b..cc2f660d3a2 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index d8cc544bc98..9858fdaa7a9 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index d0da5616e66..534d1f3086e 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index bab00f06df6..b777f8407ef 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index ba7dc7fcb58..701804a6858 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 832137f69e4..c88a95c0bb6 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index f569a24638c..a0fdb36e084 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index aac25bdf6da..ec177fe742a 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 1bfa1640343..6eddb8e4289 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 26c469466ec..de1913bb912 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 5fa30eb13d6..8672ed67c07 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 9b83ae4098b..8dcd5f85610 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 3030a176f1b..0454ad2b59d 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 04d9c4a534c..45b7e383fb7 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index f93c8fa41b9..353b045e37e 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 517337f0ee0..9e947730ba4 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 01a683744c8..d794a4fe062 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index bd6593f5a7f..2c883986cf8 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 26da3317e09..0322058c724 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index eefe4608833..8a2cd059d52 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index ab7ee36e0ff..91cde66221b 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 9692b664857..9cf639de947 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 0299f09ba5f..75e6708f7ee 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 01a4557a7e7..f4d575e3813 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index b4fb5626d91..121a4061c19 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 0e6c76e296c..23c35089ce7 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 8dfe2fdd1b2..430865472c7 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index a52b141b0bb..97112350537 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index d0bf720598c..e8a7b5ecfad 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 125a87902c8..a1f76ef154d 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index ac0c2953d19..31f96ad2527 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr1621.0" +version = "1.0.0-pr.1621.0" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 95de5b0ebb7..7561be0624f 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr1621.0", + "version": "1.0.0-pr.1621.0", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From a6c8b8008cb6933a154e48d59bfb4a8ac2c320a2 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 12:22:14 -0800 Subject: [PATCH 41/51] fixed tag --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 40 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d892d118a24..c89f65af52c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 4e72c793bed..6e5622f72c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 39d7c3cad2b..12827cf0fd4 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index dd8a5d58f3d..7bd50517cd6 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index e7628809230..79347275da2 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 74a4478bc68..162f0fa45e7 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 92f5ef353e1..b6d57710782 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index cc2f660d3a2..e48ab503bcf 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 9858fdaa7a9..d12a4444920 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 534d1f3086e..61541754fc5 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index b777f8407ef..aae0368d075 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 701804a6858..b196bee51dd 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index c88a95c0bb6..db79ad1075f 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index a0fdb36e084..36119807f1d 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index ec177fe742a..633b01cce2f 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 6eddb8e4289..fc99de9041f 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index de1913bb912..560873a4806 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 8672ed67c07..ee231b2f2de 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 8dcd5f85610..1b37993a921 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 0454ad2b59d..402e76d5bfb 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 45b7e383fb7..3ce6d52c2c0 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 353b045e37e..603bd07da40 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 9e947730ba4..d5677067322 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index d794a4fe062..fbee182c5ff 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 2c883986cf8..5558b2a7051 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 0322058c724..82b2471f4af 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 8a2cd059d52..dbb550c23ff 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 91cde66221b..eb22aadb296 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 9cf639de947..72fd29e87a7 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 75e6708f7ee..a678da4639c 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index f4d575e3813..b152c08d218 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 121a4061c19..73a4e6f6e1b 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 23c35089ce7..5b3ed5f59f8 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 430865472c7..baded4b2767 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 97112350537..5c9bb36995e 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 4795d046767..461e00080ef 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-dev.3", + "version": "8.0.0-pr.1621.1", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index e8a7b5ecfad..40e8f057ae5 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index a1f76ef154d..26a2f9e5cc9 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 31f96ad2527..233a71520d3 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.0" +version = "1.0.0-pr.1621.1" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 7561be0624f..364b712955e 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.0", + "version": "1.0.0-pr.1621.1", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From c4981d700d5ec616df959fc11c36438c7ec443b8 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 24 Jan 2024 13:33:02 -0800 Subject: [PATCH 42/51] fixed tag --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 41 files changed, 63 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c89f65af52c..65ef87aff9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 6e5622f72c5..bc01428b3c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 12827cf0fd4..77e4deb1a34 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 7bd50517cd6..cc4cf3979fa 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 79347275da2..70b217d3cc3 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 162f0fa45e7..9008c8043a6 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index b6d57710782..2f27eb23b80 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index e48ab503bcf..1c58c6f9f85 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index d12a4444920..f4db61f3f8e 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 61541754fc5..3f97cd5ed2c 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index aae0368d075..1ffeebc187c 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index b196bee51dd..6325eaf9cdf 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index db79ad1075f..2b92fae3f66 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index 36119807f1d..3fb7b22a5be 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 633b01cce2f..4b2d40d6ac9 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index fc99de9041f..937bbc8650a 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 78da9c3cb84..b142da90dc5 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-dev.3", + "version": "4.0.0-pr.1621.2", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 560873a4806..dba6f08828d 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index ee231b2f2de..2a2a24eb673 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 1b37993a921..269dbd0b7c6 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 402e76d5bfb..e020508c4a0 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 3ce6d52c2c0..268314ba7a2 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 603bd07da40..563440aeace 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index d5677067322..1b217f1ea8f 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index fbee182c5ff..c25f90a7066 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 5558b2a7051..79abe89002a 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 82b2471f4af..edbecd1dec9 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index dbb550c23ff..82352f7bb98 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index eb22aadb296..9b8f66e67ab 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 72fd29e87a7..9824529c154 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index a678da4639c..62d31514b9b 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index b152c08d218..f4985cccaa8 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 73a4e6f6e1b..b3dea5c7313 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 5b3ed5f59f8..44ed4e55c0f 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index baded4b2767..ca3e8364472 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 5c9bb36995e..3c66ad669ca 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 461e00080ef..c11213b31ff 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.1", + "version": "8.0.0-pr.1621.2", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 40e8f057ae5..cf862246847 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 26a2f9e5cc9..9430601dd4d 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 233a71520d3..57545674504 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.1" +version = "1.0.0-pr.1621.2" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 364b712955e..105b23344ee 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.1", + "version": "1.0.0-pr.1621.2", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From f9570adf3317422e6e5ba949f9c4bf323c6c9a3b Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 25 Jan 2024 07:02:58 -0800 Subject: [PATCH 43/51] updated quorum search function --- Cargo.lock | 46 ++++----- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../update_quorum_info/v0/mod.rs | 6 ++ .../core_chain_lock/choose_quorum/mod.rs | 8 +- .../core_chain_lock/choose_quorum/v0/mod.rs | 29 ++++-- .../verify_chain_lock_locally/v0/mod.rs | 98 +++++++++--------- .../src/platform_types/platform_state/mod.rs | 16 ++- .../platform_types/platform_state/v0/mod.rs | 99 ++++++++++++++----- .../tests/strategy_tests/execution.rs | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 48 files changed, 234 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 65ef87aff9f..67caae1e588 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index bc01428b3c7..8cc45555ae7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 77e4deb1a34..d29dd828e26 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index cc4cf3979fa..54b83913373 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 70b217d3cc3..217265584b3 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 9008c8043a6..3a51698a649 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 2f27eb23b80..8da433a4448 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 1c58c6f9f85..036b0ac91b5 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index f4db61f3f8e..106d4694aeb 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 3f97cd5ed2c..0a493185ce7 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 1ffeebc187c..55567609285 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 6325eaf9cdf..2c0451f8282 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 2b92fae3f66..86b5542a27a 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index 3fb7b22a5be..bc454fb39d6 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 4b2d40d6ac9..578158ce7e8 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 937bbc8650a..e2532b6e9f1 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index b142da90dc5..6b6c6609f87 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.2", + "version": "4.0.0-pr.1621.3", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index dba6f08828d..5f64808d0c8 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 2a2a24eb673..ee17f45da70 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 269dbd0b7c6..9cc041abbf5 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index e020508c4a0..6f5bc7ed6d8 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 268314ba7a2..0aae1d16a8b 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 563440aeace..5cd547eda10 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 1b217f1ea8f..b6e08c2b583 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index c25f90a7066..9017c2e3480 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index e2d38278f05..2c4701b4dcc 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -189,6 +189,9 @@ where block_platform_state.set_previous_chain_lock_validating_quorums( block_platform_state.last_committed_core_height(), core_block_height, + block_platform_state + .previous_height_chain_lock_validating_quorums() + .map(|(_, previous_change_height, _, _)| *previous_change_height), previous_quorums, ); } @@ -278,6 +281,9 @@ where block_platform_state.set_previous_chain_lock_validating_quorums( block_platform_state.last_committed_core_height(), core_block_height, + block_platform_state + .previous_height_chain_lock_validating_quorums() + .map(|(_, previous_change_height, _, _)| *previous_change_height), previous_chain_lock_validating_quorums, ); } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs index a2203dff73a..f939ef727ce 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/mod.rs @@ -14,6 +14,8 @@ use crate::rpc::core::CoreRPCLike; use dpp::version::PlatformVersion; +pub type ReversedQuorumHashBytes = Vec; + impl Platform where C: CoreRPCLike, @@ -25,7 +27,7 @@ where quorums: &'a BTreeMap, request_id: &[u8; 32], platform_version: &PlatformVersion, - ) -> Result, Error> { + ) -> Result, Error> { match platform_version .drive_abci .methods @@ -36,7 +38,6 @@ where llmq_quorum_type, quorums, request_id, - platform_version, )), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "choose_quorum".to_string(), @@ -53,7 +54,7 @@ where quorums: &'a BTreeMap, request_id: &[u8; 32], platform_version: &PlatformVersion, - ) -> Result, Error> { + ) -> Result, Error> { match platform_version .drive_abci .methods @@ -64,7 +65,6 @@ where llmq_quorum_type, quorums, request_id, - platform_version, )), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "choose_quorum_thread_safe".to_string(), diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index 416a160b9b3..9fce6599dbf 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -11,6 +11,7 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; +use crate::execution::platform_events::core_chain_lock::choose_quorum::ReversedQuorumHashBytes; use dpp::version::PlatformVersion; impl Platform @@ -22,12 +23,16 @@ where llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8; 32], - _platform_version: &PlatformVersion, - ) -> Option<(&'a QuorumHash, &'a BlsPublicKey)> { + ) -> Option<(ReversedQuorumHashBytes, &'a BlsPublicKey)> { // Scoring system logic - let mut scores: Vec<(&QuorumHash, &BlsPublicKey, [u8; 32])> = Vec::new(); + let mut scores: Vec<(ReversedQuorumHashBytes, &BlsPublicKey, [u8; 32])> = Vec::new(); for (quorum_hash, public_key) in quorums { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + let mut hasher = sha256d::Hash::engine(); // Serialize and hash the LLMQ type @@ -41,11 +46,11 @@ where // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); - scores.push((quorum_hash, public_key, hash_result.into())); + scores.push((quorum_hash_bytes, public_key, hash_result.into())); } scores.sort_by_key(|k| k.2); - scores.first().map(|&(hash, key, _)| (hash, key)) + scores.pop().map(|(hash, key, _)| (hash, key)) } /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums @@ -53,12 +58,16 @@ where llmq_quorum_type: QuorumType, quorums: &'a BTreeMap, request_id: &[u8; 32], - _platform_version: &PlatformVersion, - ) -> Option<(&'a QuorumHash, &'a [u8; T])> { + ) -> Option<(ReversedQuorumHashBytes, &'a [u8; T])> { // Scoring system logic - let mut scores: Vec<(&QuorumHash, &[u8; T], [u8; 32])> = Vec::new(); + let mut scores: Vec<(ReversedQuorumHashBytes, &[u8; T], [u8; 32])> = Vec::new(); for (quorum_hash, key) in quorums { + let mut quorum_hash_bytes = quorum_hash.to_byte_array().to_vec(); + + // Only the quorum hash needs reversal. + quorum_hash_bytes.reverse(); + let mut hasher = sha256d::Hash::engine(); // Serialize and hash the LLMQ type @@ -72,10 +81,10 @@ where // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); - scores.push((quorum_hash, key, hash_result.into())); + scores.push((quorum_hash_bytes, key, hash_result.into())); } scores.sort_by_key(|k| k.2); - scores.first().map(|&(hash, key, _)| (hash, key)) + scores.pop().map(|(hash, key, _)| (hash, key)) } } diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 4b0828f2561..41b661778a1 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -44,47 +44,61 @@ where + window_width - 1; - let verification_height = chain_lock.block_height.saturating_sub(SIGN_OFFSET); + let verification_height = chain_lock_height.saturating_sub(SIGN_OFFSET); if verification_height > last_block_in_window { return Ok(None); // the chain lock is too far in the future or the past to verify locally } - let (probable_quorums, second_to_check_quorums) = - if let Some((previous_quorum_height, change_quorum_height, previous_quorums)) = - platform_state.previous_height_chain_lock_validating_quorums() - { - if chain_lock_height > 8 && chain_lock_height - 8 >= *change_quorum_height { - // in this case we are sure that we should be targeting the current quorum - // We updated core chain lock height from 100 to 105, new chain lock comes in for block 114 - // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 106 (new chain lock verification height 114 - 8) - // We are sure that we should use current quorums - // If we have - // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 105 (new chain lock verification height 113 - 8) - // We should also use current quorums, this is because at 105 we are sure new chain lock validating quorums are active - (platform_state.chain_lock_validating_quorums(), None) - } else if chain_lock_height > 8 && chain_lock_height - 8 <= *previous_quorum_height - { - // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock - // We updated core chain lock height from 100 to 105, new chain lock comes in for block 106 - // -------- 98 (new chain lock verification height 106 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) - // We are sure that we should use previous quorums - // If we have - // -------- 100 (new chain lock verification height 108 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) - // We should also use previous quorums, this is because at 100 we are sure the old quorum set was active - (previous_quorums, None) - } else { - // we are in between, so we don't actually know if it was the old one or the new one to be used. - // ------- 100 (previous_quorum_height) ------ 104 (new chain lock verification height 112 - 8) -------105 (change_quorum_height) - // we should just try both, starting with the current quorums - ( - platform_state.chain_lock_validating_quorums(), - Some(previous_quorums), - ) - } + let (probable_quorums, second_to_check_quorums, should_be_verifiable) = if let Some(( + previous_quorum_height, + change_quorum_height, + previous_quorums_change_height, + previous_quorums, + )) = + platform_state.previous_height_chain_lock_validating_quorums() + { + if chain_lock_height > 8 && verification_height >= *change_quorum_height { + // in this case we are sure that we should be targeting the current quorum + // We updated core chain lock height from 100 to 105, new chain lock comes in for block 114 + // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 106 (new chain lock verification height 114 - 8) + // We are sure that we should use current quorums + // If we have + // ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) ------ 105 (new chain lock verification height 113 - 8) + // We should also use current quorums, this is because at 105 we are sure new chain lock validating quorums are active + (platform_state.chain_lock_validating_quorums(), None, true) + } else if chain_lock_height > 8 && verification_height <= *previous_quorum_height { + let should_be_verifiable = previous_quorums_change_height + .map(|previous_quorums_change_height| { + verification_height > previous_quorums_change_height + }) + .unwrap_or(false); + // In this case the quorums were changed recently meaning that we should use the previous quorums to verify the chain lock + // We updated core chain lock height from 100 to 105, new chain lock comes in for block 106 + // -------- 98 (new chain lock verification height 106 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) + // We are sure that we should use previous quorums + // If we have + // -------- 100 (new chain lock verification height 108 - 8) ------- 100 (previous_quorum_height) ------ 105 (change_quorum_height) + // We should also use previous quorums, this is because at 100 we are sure the old quorum set was active + (previous_quorums, None, should_be_verifiable) } else { - (platform_state.chain_lock_validating_quorums(), None) - }; + let should_be_verifiable = previous_quorums_change_height + .map(|previous_quorums_change_height| { + verification_height > previous_quorums_change_height + }) + .unwrap_or(false); + // we are in between, so we don't actually know if it was the old one or the new one to be used. + // ------- 100 (previous_quorum_height) ------ 104 (new chain lock verification height 112 - 8) -------105 (change_quorum_height) + // we should just try both, starting with the current quorums + ( + platform_state.chain_lock_validating_quorums(), + Some(previous_quorums), + should_be_verifiable, + ) + } + } else { + (platform_state.chain_lock_validating_quorums(), None, false) + }; // From DIP 8: https://github.com/dashpay/dips/blob/master/dip-0008.md#finalization-of-signed-blocks // The request id is SHA256("clsig", blockHeight) and the message hash is the block hash of the previously successful attempt. @@ -117,11 +131,6 @@ where return Ok(None); }; - let mut quorum_hash = quorum_hash.to_byte_array().to_vec(); - - // Only the quorum hash needs reversal. - quorum_hash.reverse(); - // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. let mut engine = sha256d::Hash::engine(); @@ -160,10 +169,6 @@ where return Ok(None); }; - let mut quorum_hash = quorum_hash.to_byte_array().to_vec(); - - quorum_hash.reverse(); - // The signature must verify against the quorum public key and SHA256(llmqType, quorumHash, SHA256(height), blockHash). llmqType and quorumHash must be taken from the quorum selected in 1. let mut engine = sha256d::Hash::engine(); @@ -200,6 +205,11 @@ where "we had no previous quorums locally, we should validate through core", ); return Ok(None); + } else if !should_be_verifiable { + tracing::trace!( + "we were in a situation where it would be possible we didn't have all quorums and we couldn't verify locally, we should validate through core", + ); + return Ok(None); } else { tracing::error!("chain lock was invalid, and we deemed there was no reason to check old quorums"); } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs index 14a1e81f5e5..c5fd648448e 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/mod.rs @@ -419,12 +419,14 @@ impl PlatformStateV0Methods for PlatformState { &mut self, previous_core_height: u32, change_core_height: u32, + previous_quorums_change_height: Option, quorums: BTreeMap, ) { match self { PlatformState::V0(v0) => v0.set_previous_chain_lock_validating_quorums( previous_core_height, change_core_height, + previous_quorums_change_height, quorums, ), } @@ -494,7 +496,12 @@ impl PlatformStateV0Methods for PlatformState { fn previous_height_chain_lock_validating_quorums( &self, - ) -> Option<&(u32, u32, BTreeMap)> { + ) -> Option<&( + u32, + u32, + Option, + BTreeMap, + )> { match self { PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums(), } @@ -502,7 +509,12 @@ impl PlatformStateV0Methods for PlatformState { fn previous_height_chain_lock_validating_quorums_mut( &mut self, - ) -> &mut Option<(u32, u32, BTreeMap)> { + ) -> &mut Option<( + u32, + u32, + Option, + BTreeMap, + )> { match self { PlatformState::V0(v0) => v0.previous_height_chain_lock_validating_quorums_mut(), } diff --git a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs index 093b97dad4f..046e0957675 100644 --- a/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs +++ b/packages/rs-drive-abci/src/platform_types/platform_state/v0/mod.rs @@ -51,11 +51,16 @@ pub struct PlatformStateV0 { /// height written in the chain lock (400 60 for mainnet) /// The first u32 is the core height at which these chain lock validating quorums were last active /// The second u32 is the core height we are changing at. - /// Keeping both is important for verifying the chain locks, as we can detect edge cases where we + /// The third u32 is the core height the previous chain lock validating quorums became active. + /// Keeping all three is important for verifying the chain locks, as we can detect edge cases where we /// must check a chain lock with both the previous height chain lock validating quorums and the /// current ones - pub previous_height_chain_lock_validating_quorums: - Option<(u32, u32, BTreeMap)>, + pub previous_height_chain_lock_validating_quorums: Option<( + u32, + u32, + Option, + BTreeMap, + )>, /// current full masternode list pub full_masternode_list: BTreeMap, @@ -134,7 +139,7 @@ pub(super) struct PlatformStateForSavingV0 { /// The quorums used for validating chain locks from a slightly previous height. #[bincode(with_serde)] pub previous_height_chain_lock_validating_quorums: - Option<(u32, u32, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, + Option<(u32, u32, Option, Vec<(Bytes32, ThresholdBlsPublicKey)>)>, /// current full masternode list pub full_masternode_list: BTreeMap, @@ -172,16 +177,24 @@ impl TryFrom for PlatformStateForSavingV0 { .collect(), previous_height_chain_lock_validating_quorums: value .previous_height_chain_lock_validating_quorums - .map(|(previous_height, change_height, inner_value)| { - ( + .map( + |( previous_height, change_height, - inner_value - .into_iter() - .map(|(k, v)| (k.to_byte_array().into(), v)) - .collect(), - ) - }), + previous_quorums_change_height, + inner_value, + )| { + ( + previous_height, + change_height, + previous_quorums_change_height, + inner_value + .into_iter() + .map(|(k, v)| (k.to_byte_array().into(), v)) + .collect(), + ) + }, + ), full_masternode_list: value .full_masternode_list .into_iter() @@ -231,16 +244,24 @@ impl From for PlatformStateV0 { .collect(), previous_height_chain_lock_validating_quorums: value .previous_height_chain_lock_validating_quorums - .map(|(previous_height, change_height, inner_value)| { - ( + .map( + |( previous_height, change_height, - inner_value - .into_iter() - .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) - .collect(), - ) - }), + previous_quorums_change_height, + inner_value, + )| { + ( + previous_height, + change_height, + previous_quorums_change_height, + inner_value + .into_iter() + .map(|(k, v)| (QuorumHash::from_byte_array(k.to_buffer()), v)) + .collect(), + ) + }, + ), full_masternode_list: value .full_masternode_list .into_iter() @@ -375,6 +396,7 @@ pub trait PlatformStateV0Methods { &mut self, previous_core_height: u32, change_core_height: u32, + previous_quorums_change_height: Option, quorums: BTreeMap, ); @@ -412,7 +434,12 @@ pub trait PlatformStateV0Methods { /// Returns a mutable reference to the previous chain lock validating quorums. fn previous_height_chain_lock_validating_quorums_mut( &mut self, - ) -> &mut Option<(u32, u32, BTreeMap)>; + ) -> &mut Option<( + u32, + u32, + Option, + BTreeMap, + )>; /// Returns a mutable reference to the full masternode list. fn full_masternode_list_mut(&mut self) -> &mut BTreeMap; @@ -428,7 +455,12 @@ pub trait PlatformStateV0Methods { /// The previous height chain lock validating quorums fn previous_height_chain_lock_validating_quorums( &self, - ) -> Option<&(u32, u32, BTreeMap)>; + ) -> Option<&( + u32, + u32, + Option, + BTreeMap, + )>; } impl PlatformStateV0Methods for PlatformStateV0 { @@ -663,10 +695,15 @@ impl PlatformStateV0Methods for PlatformStateV0 { &mut self, previous_core_height: u32, change_core_height: u32, + previous_quorums_change_height: Option, quorums: BTreeMap, ) { - self.previous_height_chain_lock_validating_quorums = - Some((previous_core_height, change_core_height, quorums)); + self.previous_height_chain_lock_validating_quorums = Some(( + previous_core_height, + change_core_height, + previous_quorums_change_height, + quorums, + )); } /// Sets the full masternode list. @@ -716,13 +753,23 @@ impl PlatformStateV0Methods for PlatformStateV0 { fn previous_height_chain_lock_validating_quorums( &self, - ) -> Option<&(u32, u32, BTreeMap)> { + ) -> Option<&( + u32, + u32, + Option, + BTreeMap, + )> { self.previous_height_chain_lock_validating_quorums.as_ref() } fn previous_height_chain_lock_validating_quorums_mut( &mut self, - ) -> &mut Option<(u32, u32, BTreeMap)> { + ) -> &mut Option<( + u32, + u32, + Option, + BTreeMap, + )> { &mut self.previous_height_chain_lock_validating_quorums } diff --git a/packages/rs-drive-abci/tests/strategy_tests/execution.rs b/packages/rs-drive-abci/tests/strategy_tests/execution.rs index 743e2320e15..a38564e2a40 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/execution.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/execution.rs @@ -612,7 +612,7 @@ pub(crate) fn run_chain_for_strategy( let mut engine = sha256d::Hash::engine(); engine.input(&[chain_lock_quorum_type as u8]); - engine.input(quorum_hash.as_byte_array()); + engine.input(quorum_hash.as_slice()); engine.input(request_id.as_byte_array()); engine.input(&block_hash); diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 79abe89002a..753c54d4bb7 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index edbecd1dec9..d7d19ac65ad 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 82352f7bb98..5d21cc872dd 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 9b8f66e67ab..5617356f85d 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 9824529c154..a40228e4387 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 62d31514b9b..d491749b11d 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index f4985cccaa8..0bb57c8c824 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index b3dea5c7313..3874ed8373a 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 44ed4e55c0f..b157bc96e45 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index ca3e8364472..a20e4709b80 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 3c66ad669ca..f678b13a541 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index c11213b31ff..33e3184597c 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.2", + "version": "8.0.0-pr.1621.3", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index cf862246847..8877f7a6e55 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 9430601dd4d..6622d1f9d65 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 57545674504..0f7499ad8e3 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.2" +version = "1.0.0-pr.1621.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 105b23344ee..e1b3c377116 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.2", + "version": "1.0.0-pr.1621.3", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 2d89cc639134c9d0678c4d06ab3afa7de2fe2f38 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 25 Jan 2024 13:47:34 -0800 Subject: [PATCH 44/51] more fixes based on feedback --- .../update_quorum_info/v0/mod.rs | 9 +++ .../mod.rs | 2 +- .../v0/mod.rs | 10 ++- .../verify_chain_lock/v0/mod.rs | 75 ++++++++++--------- .../verify_chain_lock_through_core/mod.rs | 2 +- .../verify_chain_lock_through_core/v0/mod.rs | 10 ++- .../tests/strategy_tests/chain_lock_update.rs | 6 +- .../src/version/drive_abci_versions.rs | 5 +- .../src/version/mocks/v2_test.rs | 5 +- .../src/version/mocks/v3_test.rs | 5 +- .../rs-platform-version/src/version/v1.rs | 5 +- 11 files changed, 83 insertions(+), 51 deletions(-) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 2c4701b4dcc..6f911386d19 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -218,6 +218,15 @@ where .chain_lock_validating_quorums_mut() .retain(|quorum_hash, _| { let retain = chain_lock_quorums_list.contains_key::(quorum_hash); + if !retain { + tracing::trace!( + ?quorum_hash, + quorum_type = ?chain_lock_quorum_type, + "removed old chain lock quorum {} with quorum type {}", + quorum_hash, + chain_lock_quorum_type + ); + } removed_a_chain_lock_validating_quorum |= !retain; retain }); diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs index 086d74ba839..59abfb78f6b 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/mod.rs @@ -43,7 +43,7 @@ where .core_chain_lock .make_sure_core_is_synced_to_chain_lock { - 0 => self.make_sure_core_is_synced_to_chain_lock_v0(chain_lock), + 0 => self.make_sure_core_is_synced_to_chain_lock_v0(chain_lock, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "make_sure_core_is_synced_to_chain_lock".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs index 5c5bc1a63b4..68fafb20204 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/make_sure_core_is_synced_to_chain_lock/v0/mod.rs @@ -2,6 +2,7 @@ use crate::error::Error; use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use dashcore_rpc::dashcore::ChainLock; +use dpp::version::PlatformVersion; use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus::{CoreIsSynced, CoreAlmostSynced, CoreNotSynced}; @@ -14,13 +15,20 @@ where pub(super) fn make_sure_core_is_synced_to_chain_lock_v0( &self, chain_lock: &ChainLock, + platform_version: &PlatformVersion, ) -> Result { let given_chain_lock_height = chain_lock.block_height; // We need to make sure core is synced to the core height we see as valid for the state transitions let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; Ok(if best_chain_locked_height >= given_chain_lock_height { CoreIsSynced - } else if best_chain_locked_height - given_chain_lock_height < 3 { + } else if best_chain_locked_height - given_chain_lock_height + <= platform_version + .drive_abci + .methods + .core_chain_lock + .recent_block_count_amount + { CoreAlmostSynced } else { CoreNotSynced diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index e80238615e8..6609a738ac6 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -11,6 +11,9 @@ use crate::platform_types::platform_state::PlatformState; use crate::rpc::core::CoreRPCLike; +const CORE_ALMOST_SYNCED_RETRIES: u32 = 5; +const CORE_ALMOST_SYNCED_SLEEP_TIME: u64 = 200; + impl Platform where C: CoreRPCLike, @@ -37,24 +40,27 @@ where core_is_synced: Some(true), }), CoreSyncStatus::CoreAlmostSynced => { - // The chain lock is valid we just need to sleep a bit and retry - sleep(Duration::from_millis(200)); - let best_chain_locked = self.core_rpc.get_best_chain_lock()?; - if best_chain_locked.block_height < chain_lock.block_height { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: Some(true), - found_valid_by_core: Some(true), - core_is_synced: Some(false), - }) - } else { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: Some(valid), - found_valid_by_core: Some(true), - core_is_synced: Some(true), - }) + for _i in 0..CORE_ALMOST_SYNCED_RETRIES { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(CORE_ALMOST_SYNCED_SLEEP_TIME)); + let best_chain_locked = + self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height >= chain_lock.block_height + { + return Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(valid), + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }); + } } + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: Some(true), + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) } CoreSyncStatus::CoreNotSynced => Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, @@ -102,24 +108,25 @@ where core_is_synced: Some(true), }), CoreSyncStatus::CoreAlmostSynced => { - // The chain lock is valid we just need to sleep a bit and retry - sleep(Duration::from_millis(200)); - let best_chain_locked = self.core_rpc.get_best_chain_lock()?; - if best_chain_locked.block_height < chain_lock.block_height { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: None, - found_valid_by_core: Some(true), - core_is_synced: Some(false), - }) - } else { - Ok(VerifyChainLockResult { - chain_lock_signature_is_deserializable: true, - found_valid_locally: None, - found_valid_by_core: Some(true), - core_is_synced: Some(true), - }) + for _i in 0..CORE_ALMOST_SYNCED_RETRIES { + // The chain lock is valid we just need to sleep a bit and retry + sleep(Duration::from_millis(CORE_ALMOST_SYNCED_SLEEP_TIME)); + let best_chain_locked = self.core_rpc.get_best_chain_lock()?; + if best_chain_locked.block_height >= chain_lock.block_height { + return Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(true), + }); + } } + Ok(VerifyChainLockResult { + chain_lock_signature_is_deserializable: true, + found_valid_locally: None, + found_valid_by_core: Some(true), + core_is_synced: Some(false), + }) } CoreSyncStatus::CoreNotSynced => Ok(VerifyChainLockResult { chain_lock_signature_is_deserializable: true, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs index a1750c22b93..e7c585498d7 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/mod.rs @@ -28,7 +28,7 @@ where .core_chain_lock .verify_chain_lock_through_core { - 0 => self.verify_chain_lock_through_core_v0(chain_lock, submit), + 0 => self.verify_chain_lock_through_core_v0(chain_lock, submit, platform_version), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock_through_core".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs index ccc9fb1fddc..063794afc13 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_through_core/v0/mod.rs @@ -1,5 +1,6 @@ use crate::error::Error; use dpp::dashcore::ChainLock; +use dpp::version::PlatformVersion; use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus; use crate::execution::platform_events::core_chain_lock::make_sure_core_is_synced_to_chain_lock::CoreSyncStatus::{CoreAlmostSynced, CoreIsSynced, CoreNotSynced}; @@ -16,6 +17,7 @@ where &self, chain_lock: &ChainLock, submit: bool, + platform_version: &PlatformVersion, ) -> Result<(bool, Option), Error> { if submit { let given_chain_lock_height = chain_lock.block_height; @@ -23,7 +25,13 @@ where let best_chain_locked_height = self.core_rpc.submit_chain_lock(chain_lock)?; Ok(if best_chain_locked_height >= given_chain_lock_height { (true, Some(CoreIsSynced)) - } else if best_chain_locked_height - given_chain_lock_height < 3 { + } else if best_chain_locked_height - given_chain_lock_height + <= platform_version + .drive_abci + .methods + .core_chain_lock + .recent_block_count_amount + { (true, Some(CoreAlmostSynced)) } else { (true, Some(CoreNotSynced)) diff --git a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs index d9b34bce2c4..a6a3e57e894 100644 --- a/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs +++ b/packages/rs-drive-abci/tests/strategy_tests/chain_lock_update.rs @@ -82,10 +82,6 @@ mod tests { .with_config(config.clone()) .build_with_mock_rpc(); - let outcome = run_chain_for_strategy(&mut platform, 50, strategy, config, 13); - - // we expect to see quorums with banned members - - let state = outcome.abci_app.platform.state.read().unwrap(); + run_chain_for_strategy(&mut platform, 50, strategy, config, 13); } } diff --git a/packages/rs-platform-version/src/version/drive_abci_versions.rs b/packages/rs-platform-version/src/version/drive_abci_versions.rs index 53dbfd1aaf8..30a22a46ec4 100644 --- a/packages/rs-platform-version/src/version/drive_abci_versions.rs +++ b/packages/rs-platform-version/src/version/drive_abci_versions.rs @@ -61,7 +61,7 @@ pub struct DriveAbciMethodVersions { pub protocol_upgrade: DriveAbciProtocolUpgradeMethodVersions, pub block_fee_processing: DriveAbciBlockFeeProcessingMethodVersions, pub core_subsidy: DriveAbciCoreSubsidyMethodVersions, - pub core_chain_lock: DriveAbciCoreChainLockMethodVersions, + pub core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants, pub fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions, pub fee_pool_outwards_distribution: DriveAbciFeePoolOutwardsDistributionMethodVersions, pub identity_credit_withdrawal: DriveAbciIdentityCreditWithdrawalMethodVersions, @@ -198,12 +198,13 @@ pub struct DriveAbciCoreSubsidyMethodVersions { } #[derive(Clone, Debug, Default)] -pub struct DriveAbciCoreChainLockMethodVersions { +pub struct DriveAbciCoreChainLockMethodVersionsAndConstants { pub choose_quorum: FeatureVersion, pub verify_chain_lock: FeatureVersion, pub verify_chain_lock_locally: FeatureVersion, pub verify_chain_lock_through_core: FeatureVersion, pub make_sure_core_is_synced_to_chain_lock: FeatureVersion, + pub recent_block_count_amount: u32, //what constitutes a recent block, for v0 it's 2. } #[derive(Clone, Debug, Default)] diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index d26227f482d..1b75622a06c 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -12,7 +12,7 @@ use crate::version::dpp_versions::{ use crate::version::drive_abci_versions::{ DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersionsAndConstants, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, @@ -499,12 +499,13 @@ pub(crate) const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { core_subsidy: DriveAbciCoreSubsidyMethodVersions { epoch_core_reward_credits_for_distribution: 0, }, - core_chain_lock: DriveAbciCoreChainLockMethodVersions { + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { choose_quorum: 0, verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index f41a8165ace..b0fd24bf5bb 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -12,7 +12,7 @@ use crate::version::dpp_versions::{ use crate::version::drive_abci_versions::{ DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersionsAndConstants, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, @@ -499,12 +499,13 @@ pub(crate) const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { core_subsidy: DriveAbciCoreSubsidyMethodVersions { epoch_core_reward_credits_for_distribution: 0, }, - core_chain_lock: DriveAbciCoreChainLockMethodVersions { + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { choose_quorum: 0, verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index 8c64901d110..32540ad306d 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -12,7 +12,7 @@ use crate::version::dpp_versions::{ use crate::version::drive_abci_versions::{ DriveAbciAssetLockValidationVersions, DriveAbciBlockEndMethodVersions, DriveAbciBlockFeeProcessingMethodVersions, DriveAbciBlockStartMethodVersions, - DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersions, + DriveAbciCoreBasedUpdatesMethodVersions, DriveAbciCoreChainLockMethodVersionsAndConstants, DriveAbciCoreSubsidyMethodVersions, DriveAbciDocumentsStateTransitionValidationVersions, DriveAbciEngineMethodVersions, DriveAbciEpochMethodVersions, DriveAbciFeePoolInwardsDistributionMethodVersions, @@ -496,12 +496,13 @@ pub(super) const PLATFORM_V1: PlatformVersion = PlatformVersion { core_subsidy: DriveAbciCoreSubsidyMethodVersions { epoch_core_reward_credits_for_distribution: 0, }, - core_chain_lock: DriveAbciCoreChainLockMethodVersions { + core_chain_lock: DriveAbciCoreChainLockMethodVersionsAndConstants { choose_quorum: 0, verify_chain_lock: 0, verify_chain_lock_locally: 0, verify_chain_lock_through_core: 0, make_sure_core_is_synced_to_chain_lock: 0, + recent_block_count_amount: 2, }, fee_pool_inwards_distribution: DriveAbciFeePoolInwardsDistributionMethodVersions { add_distribute_block_fees_into_pools_operations: 0, From 94297e10fa4acd80e4842e1edce6efc1148feb27 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 26 Jan 2024 08:54:26 -0800 Subject: [PATCH 45/51] updated choose quorum --- Cargo.lock | 46 +-- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../core_chain_lock/choose_quorum/v0/mod.rs | 295 +++++++++++++++++- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 42 files changed, 345 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67caae1e588..655550a7849 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 8cc45555ae7..c50a3121df0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index d29dd828e26..8e5ae547d5c 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 54b83913373..61db5d9befb 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 217265584b3..a8d51f7f99d 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 3a51698a649..9e9cd2e2ccd 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 8da433a4448..f5b65a10cf5 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 036b0ac91b5..af01f823d2d 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 106d4694aeb..6bf2dfa4855 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 0a493185ce7..2455029149c 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 55567609285..e2b4f33f1bb 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 2c0451f8282..4ddd83f8a2c 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 86b5542a27a..be5ec72ba1d 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index bc454fb39d6..686fcee628d 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 578158ce7e8..74eaf2f1529 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index e2532b6e9f1..9f1f8625bcc 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 6b6c6609f87..42a91e1ac90 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.3", + "version": "4.0.0-pr.1621.4", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 5f64808d0c8..1c7a42511fd 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index ee17f45da70..9f99ef39f96 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 9cc041abbf5..80265e94af1 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 6f5bc7ed6d8..0e31b06dffe 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 0aae1d16a8b..46367d8d4cb 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 5cd547eda10..0b59844fff2 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index b6e08c2b583..7086539d964 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 9017c2e3480..74a4a5e09b4 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index 9fce6599dbf..3bdac4d46f4 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -1,10 +1,7 @@ -use crate::error::Error; use dashcore_rpc::dashcore_rpc_json::QuorumType; use dpp::bls_signatures::PublicKey as BlsPublicKey; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; use dpp::dashcore::{ChainLock, QuorumHash}; -use dpp::platform_value::Bytes32; -use sha2::Sha256; use std::collections::BTreeMap; use crate::platform_types::platform::Platform; @@ -12,12 +9,8 @@ use crate::platform_types::platform::Platform; use crate::rpc::core::CoreRPCLike; use crate::execution::platform_events::core_chain_lock::choose_quorum::ReversedQuorumHashBytes; -use dpp::version::PlatformVersion; -impl Platform -where - C: CoreRPCLike, -{ +impl Platform { /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums pub(super) fn choose_quorum_v0<'a>( llmq_quorum_type: QuorumType, @@ -33,16 +26,21 @@ where // Only the quorum hash needs reversal. quorum_hash_bytes.reverse(); + let mut request_id_bytes = request_id.to_vec(); + + // Only the quorum hash needs reversal. + request_id_bytes.reverse(); + let mut hasher = sha256d::Hash::engine(); // Serialize and hash the LLMQ type hasher.input(&[llmq_quorum_type as u8]); // Serialize and add the quorum hash - hasher.input(quorum_hash.as_byte_array()); + hasher.input(quorum_hash_bytes.as_slice()); // Serialize and add the selection hash from the chain lock - hasher.input(request_id.as_slice()); + hasher.input(request_id_bytes.as_slice()); // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); @@ -50,7 +48,10 @@ where } scores.sort_by_key(|k| k.2); - scores.pop().map(|(hash, key, _)| (hash, key)) + + let (quorum_hash, key, _) = scores.remove(0); + + Some((quorum_hash, key)) } /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums @@ -68,16 +69,21 @@ where // Only the quorum hash needs reversal. quorum_hash_bytes.reverse(); + let mut request_id_bytes = request_id.to_vec(); + + // Only the quorum hash needs reversal. + request_id_bytes.reverse(); + let mut hasher = sha256d::Hash::engine(); // Serialize and hash the LLMQ type hasher.input(&[llmq_quorum_type as u8]); // Serialize and add the quorum hash - hasher.input(quorum_hash.as_byte_array()); + hasher.input(quorum_hash_bytes.as_slice()); // Serialize and add the selection hash from the chain lock - hasher.input(request_id.as_slice()); + hasher.input(request_id_bytes.as_slice()); // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); @@ -88,3 +94,266 @@ where scores.pop().map(|(hash, key, _)| (hash, key)) } } + +#[cfg(test)] +mod tests { + use crate::platform_types::platform::Platform; + use crate::rpc::core::{CoreRPCLike, MockCoreRPCLike}; + use dashcore_rpc::dashcore_rpc_json::QuorumType; + use dpp::bls_signatures::PublicKey as BlsPublicKey; + use dpp::dashcore::hashes::Hash; + use dpp::dashcore::QuorumHash; + use std::collections::BTreeMap; + + #[test] + fn test_choose_quorum() { + // Active quorums: + let quorum_hash1 = QuorumHash::from_slice( + hex::decode("000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash2 = QuorumHash::from_slice( + hex::decode("000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash3 = QuorumHash::from_slice( + hex::decode("0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorum_hash4 = QuorumHash::from_slice( + hex::decode("0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e") + .unwrap() + .as_slice(), + ) + .unwrap(); + let quorums = BTreeMap::from([ + (quorum_hash1, BlsPublicKey::generate()), + (quorum_hash2, BlsPublicKey::generate()), + (quorum_hash3, BlsPublicKey::generate()), + (quorum_hash4, BlsPublicKey::generate()), + ]); + + // + // ############### + // llmqType[1] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[4] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[5] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 + // llmqType[100] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + + let request_id: [u8; 32] = + hex::decode("bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5") + .unwrap() + .try_into() + .unwrap(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + // ############### + // llmqType[1] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[4] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[5] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[100] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b + + let request_id: [u8; 32] = + hex::decode("b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20") + .unwrap() + .try_into() + .unwrap(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b" + ); + + // ############### + // llmqType[1] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[4] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e + // llmqType[5] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 + // llmqType[100] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 + + let request_id: [u8; 32] = + hex::decode("2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10") + .unwrap() + .try_into() + .unwrap(); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq50_60, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq100_67, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::Llmq60_75, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071" + ); + + let mut quorum = Platform::::choose_quorum_v0( + QuorumType::LlmqTest, + &quorums, + &request_id, + ) + .unwrap() + .0; + + quorum.reverse(); + + assert_eq!( + hex::encode(quorum), + "000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223" + ); + } +} diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 753c54d4bb7..fc26efe11a5 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index d7d19ac65ad..3cd95dd5031 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 5d21cc872dd..c3d82e272c4 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 5617356f85d..35e757aa7f7 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index a40228e4387..e02f9e3e1aa 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index d491749b11d..fd1823a9da4 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 0bb57c8c824..81764ebb75b 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 3874ed8373a..aad29a3a7a5 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index b157bc96e45..adbda0779bf 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index a20e4709b80..054bf0e72ba 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index f678b13a541..432b21c310a 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 33e3184597c..ca295bf17bf 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.3", + "version": "8.0.0-pr.1621.4", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 8877f7a6e55..edab1e0bf17 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 6622d1f9d65..5ebe470c849 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 0f7499ad8e3..04102ff5720 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.3" +version = "1.0.0-pr.1621.4" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index e1b3c377116..c5a2e5d4e71 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.3", + "version": "1.0.0-pr.1621.4", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 2873d1bd2353a92220039e093f4ea2b8fab9037c Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 26 Jan 2024 17:07:24 -0800 Subject: [PATCH 46/51] fixed an issue where validator_set_quorum_type == chain_lock_quorum_type with old blocks on init chain --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../update_quorum_info/v0/mod.rs | 19 ++++---- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 42 files changed, 74 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 655550a7849..b24a779f7b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index c50a3121df0..6759e4a72aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 8e5ae547d5c..3297c66c025 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 61db5d9befb..65ec9dfeacc 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index a8d51f7f99d..e800d29555c 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 9e9cd2e2ccd..a5ac29219d6 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index f5b65a10cf5..0887dc0da3b 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index af01f823d2d..2b9adf9abc1 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 6bf2dfa4855..655e08f322b 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 2455029149c..7db3b427aec 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index e2b4f33f1bb..29fdec79ec3 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 4ddd83f8a2c..4dc7b8509d2 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index be5ec72ba1d..6787efb0180 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index 686fcee628d..f0376decaeb 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 74eaf2f1529..c7a2015cad7 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 9f1f8625bcc..321d9b5d35c 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 42a91e1ac90..bd74079698e 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.4", + "version": "4.0.0-pr.1621.5", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 1c7a42511fd..32b47fbd9db 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 9f99ef39f96..9c06f3e4ebf 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 80265e94af1..90c76274599 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 0e31b06dffe..8f701af956d 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 46367d8d4cb..f64d52d939b 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 0b59844fff2..d5d5abc2750 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 7086539d964..b9eeeda15ec 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 74a4a5e09b4..5ab511c3425 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs index 6f911386d19..26035b5e200 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs @@ -186,14 +186,17 @@ where let previous_quorums = block_platform_state .replace_chain_lock_validating_quorums(chain_lock_validating_quorums); tracing::trace!("updated chain lock validating quorums to current validator set",); - block_platform_state.set_previous_chain_lock_validating_quorums( - block_platform_state.last_committed_core_height(), - core_block_height, - block_platform_state - .previous_height_chain_lock_validating_quorums() - .map(|(_, previous_change_height, _, _)| *previous_change_height), - previous_quorums, - ); + // the only case where there will be no platform_state is init chain where we + if platform_state.is_some() { + block_platform_state.set_previous_chain_lock_validating_quorums( + block_platform_state.last_committed_core_height(), + core_block_height, + block_platform_state + .previous_height_chain_lock_validating_quorums() + .map(|(_, previous_change_height, _, _)| *previous_change_height), + previous_quorums, + ); + } } } else { let chain_lock_quorums_list: BTreeMap<_, _> = extended_quorum_list diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index fc26efe11a5..85d511c683f 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 3cd95dd5031..b6f985fea7c 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index c3d82e272c4..8bd15c73a53 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 35e757aa7f7..6551ea1bfb7 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index e02f9e3e1aa..a0399029663 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index fd1823a9da4..6501613f115 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 81764ebb75b..aa873838ffe 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index aad29a3a7a5..9f3b2bf233c 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index adbda0779bf..3af18360d9a 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 054bf0e72ba..17547938397 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 432b21c310a..f0a94bfc8f5 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index ca295bf17bf..8d5dd001add 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.4", + "version": "8.0.0-pr.1621.5", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index edab1e0bf17..3033e646cde 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 5ebe470c849..72a15f04012 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 04102ff5720..8e4f6cb9e33 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.4" +version = "1.0.0-pr.1621.5" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index c5a2e5d4e71..78836202fa5 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.4", + "version": "1.0.0-pr.1621.5", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 252155def95c8146148b77bb32d2e09b10ad37d0 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 26 Jan 2024 18:00:08 -0800 Subject: [PATCH 47/51] fixed a removal --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../core_chain_lock/choose_quorum/v0/mod.rs | 10 ++-- .../verify_chain_lock_locally/v0/mod.rs | 7 ++- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 43 files changed, 75 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b24a779f7b6..5bc61cd4d84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 6759e4a72aa..b4890f1f4b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 3297c66c025..6dc6af338e3 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 65ec9dfeacc..b9f3ee571b2 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index e800d29555c..50c09f9f853 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index a5ac29219d6..1287208ba79 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 0887dc0da3b..08e2ade55d3 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 2b9adf9abc1..350fd116911 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 655e08f322b..71d27effb04 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 7db3b427aec..370908bd25f 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 29fdec79ec3..9f6a4942c89 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 4dc7b8509d2..3836f2342bd 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 6787efb0180..1124fbff0eb 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index f0376decaeb..c0d2cf1c2f4 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index c7a2015cad7..619622a314a 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 321d9b5d35c..59c4a29fc9b 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index bd74079698e..9d0b27c6583 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.5", + "version": "4.0.0-pr.1621.6", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 32b47fbd9db..73f06eec879 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 9c06f3e4ebf..5f6b0cbd563 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 90c76274599..6f429b10a64 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 8f701af956d..311ab979e9b 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index f64d52d939b..95e95c72760 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index d5d5abc2750..1bf33fb9d0b 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index b9eeeda15ec..f684a67ef61 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 5ab511c3425..a202ada1ee0 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index 3bdac4d46f4..f5ddc0c4af8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -47,11 +47,15 @@ impl Platform { scores.push((quorum_hash_bytes, public_key, hash_result.into())); } - scores.sort_by_key(|k| k.2); + if scores.is_empty() { + None + } else { + scores.sort_by_key(|k| k.2); - let (quorum_hash, key, _) = scores.remove(0); + let (quorum_hash, key, _) = scores.remove(0); - Some((quorum_hash, key)) + Some((quorum_hash, key)) + } } /// Based on DIP8 deterministically chooses a pseudorandom quorum from the list of quorums diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 41b661778a1..467adbcf79a 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -146,12 +146,15 @@ where tracing::trace!( ?chain_lock, - "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification window {}, last block in window" chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), hex::encode(chain_lock.block_hash.as_byte_array()), - if chain_lock_verified { "verified"} else {"not verified"} + if chain_lock_verified { "verified"} else {"not verified"}, + platform_state.last_committed_core_height(), + verification_height, + last_block_in_window, ); if !chain_lock_verified { diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 85d511c683f..e140ebc5b0a 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index b6f985fea7c..c690e0bf07c 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 8bd15c73a53..1d6be7fa844 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 6551ea1bfb7..d1ea0b3393e 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index a0399029663..3da3cf23dab 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 6501613f115..a1848fd68ed 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index aa873838ffe..0386507f100 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 9f3b2bf233c..f683cd145f8 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 3af18360d9a..7ec4c41bb2b 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 17547938397..5981324fcf3 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index f0a94bfc8f5..0edd23fc2a4 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 8d5dd001add..725f6baca0b 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.5", + "version": "8.0.0-pr.1621.6", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 3033e646cde..db4a1c931f3 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 72a15f04012..1c41e9049b4 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 8e4f6cb9e33..e8adae94f81 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.5" +version = "1.0.0-pr.1621.6" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 78836202fa5..c26e5050ad6 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.5", + "version": "1.0.0-pr.1621.6", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 4d9ef72c8f25ba22f4c7aaedd71f38e0ef8a849d Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 26 Jan 2024 18:20:40 -0800 Subject: [PATCH 48/51] fixed typo --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../verify_chain_lock_locally/v0/mod.rs | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 42 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5bc61cd4d84..d10aa58addd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index b4890f1f4b8..53cb832a4ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 6dc6af338e3..aefee71f673 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index b9f3ee571b2..e6141db4c09 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 50c09f9f853..40f60c48412 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 1287208ba79..99d0c78a1b5 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 08e2ade55d3..0f442bc33cc 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 350fd116911..bcb164a6c3b 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 71d27effb04..0c15542eb27 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 370908bd25f..d967bcc5c03 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 9f6a4942c89..5b8b598a0c6 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 3836f2342bd..ff8e1cc5b47 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 1124fbff0eb..5dfd03a3136 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index c0d2cf1c2f4..e7ed429251c 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 619622a314a..b7710d5d3b9 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index 59c4a29fc9b..cb2647c122f 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 9d0b27c6583..6807a14b26b 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.6", + "version": "4.0.0-pr.1621.7", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 73f06eec879..dbe57cc852e 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 5f6b0cbd563..25ad5db2d33 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 6f429b10a64..7df95ce1d99 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 311ab979e9b..009fe85ce17 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 95e95c72760..883f648e0a5 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 1bf33fb9d0b..9906e527a18 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index f684a67ef61..54d295b4eb1 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index a202ada1ee0..90798d9af5b 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 467adbcf79a..6aaa7510600 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -146,7 +146,7 @@ where tracing::trace!( ?chain_lock, - "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification window {}, last block in window" + "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification window {}, last block in window {}", chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index e140ebc5b0a..43a23c1882f 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index c690e0bf07c..42af6723cd2 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index 1d6be7fa844..bd30786b76a 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index d1ea0b3393e..ec55003ec6f 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 3da3cf23dab..d41f391af15 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index a1848fd68ed..0323ddfc91f 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 0386507f100..56af7d0c284 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index f683cd145f8..dd133a34137 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 7ec4c41bb2b..06d448a9a51 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 5981324fcf3..12f497bb34a 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 0edd23fc2a4..fdbe6a0507c 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 725f6baca0b..928feb81b7c 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.6", + "version": "8.0.0-pr.1621.7", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index db4a1c931f3..668e7d8befc 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 1c41e9049b4..98d4271cb35 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index e8adae94f81..9f7adfc759f 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.6" +version = "1.0.0-pr.1621.7" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index c26e5050ad6..17cdb5775c4 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.6", + "version": "1.0.0-pr.1621.7", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 4d76ba2f5775b488cdc3fd54b3bb6649061a0557 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 27 Jan 2024 02:11:22 -0800 Subject: [PATCH 49/51] trial --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../core_chain_lock/choose_quorum/v0/mod.rs | 4 +- .../verify_chain_lock_locally/v0/mod.rs | 7 ++- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 43 files changed, 70 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d10aa58addd..b10cefb65c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 53cb832a4ad..567a8fc18eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index aefee71f673..4e6492e2199 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index e6141db4c09..1368a80690c 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 40f60c48412..ddb42a71439 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 99d0c78a1b5..6149335b519 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 0f442bc33cc..d70e0f99721 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index bcb164a6c3b..87518cab832 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 0c15542eb27..528f321e7e0 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index d967bcc5c03..3edac6db8ab 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 5b8b598a0c6..ae6f4cdeb60 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index ff8e1cc5b47..409e981b965 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 5dfd03a3136..2975dfb7413 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index e7ed429251c..d1d4d1558af 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index b7710d5d3b9..96fb2403a05 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index cb2647c122f..e00fc8ad31e 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 6807a14b26b..feaa47e2ca8 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.7", + "version": "4.0.0-pr.1621.8", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index dbe57cc852e..58a2a72d17d 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 25ad5db2d33..2522a222435 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 7df95ce1d99..6365d073e62 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 009fe85ce17..240efb6babc 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 883f648e0a5..5634c4ffb51 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index 9906e527a18..ff11cbbba59 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 54d295b4eb1..6e583d9deb8 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 90798d9af5b..ec2df98b98f 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index f5ddc0c4af8..0de549e7036 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -29,7 +29,7 @@ impl Platform { let mut request_id_bytes = request_id.to_vec(); // Only the quorum hash needs reversal. - request_id_bytes.reverse(); + // request_id_bytes.reverse(); let mut hasher = sha256d::Hash::engine(); @@ -76,7 +76,7 @@ impl Platform { let mut request_id_bytes = request_id.to_vec(); // Only the quorum hash needs reversal. - request_id_bytes.reverse(); + // request_id_bytes.reverse(); let mut hasher = sha256d::Hash::engine(); diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index 6aaa7510600..f5ed6e8bbc0 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -1,3 +1,4 @@ +use dpp::block::block_info::BlockInfo; use dpp::bls_signatures::G2Element; use dpp::dashcore::consensus::Encodable; use dpp::dashcore::hashes::{sha256d, Hash, HashEngine}; @@ -146,7 +147,8 @@ where tracing::trace!( ?chain_lock, - "message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification window {}, last block in window {}", + "h:{} message_digest for chain lock at core height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification window {}, last block in window {}", + platform_state.last_committed_block_height() + 1, chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), @@ -187,7 +189,8 @@ where tracing::trace!( ?chain_lock, - "tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + "h:{} tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + platform_state.last_committed_block_height() + 1, chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 43a23c1882f..7c7bc25a789 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 42af6723cd2..af407ba56f1 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index bd30786b76a..eeac7252a11 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index ec55003ec6f..88c6cf41ff2 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index d41f391af15..c33bc38c49c 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 0323ddfc91f..21805cfab50 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 56af7d0c284..cdb95b1526a 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index dd133a34137..11025c10f0f 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 06d448a9a51..8e3c2619653 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 12f497bb34a..3107bb9b832 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index fdbe6a0507c..2a7a8a1cb94 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 928feb81b7c..0dfb7404de0 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.7", + "version": "8.0.0-pr.1621.8", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 668e7d8befc..e808cc74d00 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 98d4271cb35..9193b724ba2 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 9f7adfc759f..f1c93ddaf7b 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.7" +version = "1.0.0-pr.1621.8" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 17cdb5775c4..83c76e85d55 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.7", + "version": "1.0.0-pr.1621.8", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 9ec8c2b8cc6f5ecc177d9868eee1d80a5b1a01c6 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sat, 27 Jan 2024 11:03:33 -0800 Subject: [PATCH 50/51] final version --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- .../engine/run_block_proposal/v0/mod.rs | 1 + .../core_chain_lock/choose_quorum/v0/mod.rs | 26 +++++------ .../core_chain_lock/verify_chain_lock/mod.rs | 2 + .../verify_chain_lock/v0/mod.rs | 3 +- .../verify_chain_lock_locally/mod.rs | 8 +++- .../verify_chain_lock_locally/v0/mod.rs | 31 +++++++++---- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 47 files changed, 109 insertions(+), 88 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b10cefb65c9..116eb3dcb62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index 567a8fc18eb..b14815ccafb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 4e6492e2199..79d20826dad 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index 1368a80690c..dc4bab480df 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index ddb42a71439..362c65ef940 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 6149335b519..21b7ccd10c5 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index d70e0f99721..1bae9fbd5ac 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 87518cab832..652a1927c70 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index 528f321e7e0..d09fb140d5c 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index 3edac6db8ab..c2b8c280894 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index ae6f4cdeb60..2d668a752d3 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 409e981b965..2579bfda02b 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index 2975dfb7413..a4a7b19eec0 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index d1d4d1558af..66f727ca342 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index 96fb2403a05..a5a64b038ab 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index e00fc8ad31e..e4b9979a3b8 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index feaa47e2ca8..0ae612a6a4e 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.8", + "version": "4.0.0-pr.1621.9", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 58a2a72d17d..97ac8224f93 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 2522a222435..6f5d5531eda 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 6365d073e62..99d9fe2e478 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index 240efb6babc..f4e90a498d5 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 5634c4ffb51..7aa8f1cca5b 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index ff11cbbba59..f94d0afc265 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index 6e583d9deb8..a5a816862a9 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index ec2df98b98f..3cac2b38f5b 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs index 163d74708d4..b10494886a9 100644 --- a/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/run_block_proposal/v0/mod.rs @@ -130,6 +130,7 @@ where if let Some(core_chain_lock_update) = core_chain_lock_update.as_ref() { if !known_from_us { let verification_result = self.verify_chain_lock( + block_state_info.round, // the round is to allow us to bypass local verification in case of chain stall &block_platform_state, core_chain_lock_update, true, // if it's not known from us, then we should try submitting it diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs index 0de549e7036..8fd8156732c 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/choose_quorum/v0/mod.rs @@ -26,11 +26,6 @@ impl Platform { // Only the quorum hash needs reversal. quorum_hash_bytes.reverse(); - let mut request_id_bytes = request_id.to_vec(); - - // Only the quorum hash needs reversal. - // request_id_bytes.reverse(); - let mut hasher = sha256d::Hash::engine(); // Serialize and hash the LLMQ type @@ -40,7 +35,7 @@ impl Platform { hasher.input(quorum_hash_bytes.as_slice()); // Serialize and add the selection hash from the chain lock - hasher.input(request_id_bytes.as_slice()); + hasher.input(request_id.as_slice()); // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); @@ -73,11 +68,6 @@ impl Platform { // Only the quorum hash needs reversal. quorum_hash_bytes.reverse(); - let mut request_id_bytes = request_id.to_vec(); - - // Only the quorum hash needs reversal. - // request_id_bytes.reverse(); - let mut hasher = sha256d::Hash::engine(); // Serialize and hash the LLMQ type @@ -87,7 +77,7 @@ impl Platform { hasher.input(quorum_hash_bytes.as_slice()); // Serialize and add the selection hash from the chain lock - hasher.input(request_id_bytes.as_slice()); + hasher.input(request_id.as_slice()); // Finalize the hash let hash_result = sha256d::Hash::from_engine(hasher); @@ -150,12 +140,14 @@ mod tests { // llmqType[5] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 // llmqType[100] requestID[bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5] -> 0000000e6d15a11825211c943c4a995c44ebb2b0834b7848c2e080b48ca0148e - let request_id: [u8; 32] = + let mut request_id: [u8; 32] = hex::decode("bdcf9fb3ef01209a09db19170a1950775afb5f824c5f0662b9cdae2bf3bb36d5") .unwrap() .try_into() .unwrap(); + request_id.reverse(); + let mut quorum = Platform::::choose_quorum_v0( QuorumType::Llmq50_60, &quorums, @@ -222,12 +214,14 @@ mod tests { // llmqType[5] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 // llmqType[100] requestID[b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20] -> 0000006faac9003919a6d5456a0a46ae10db517f572221279f0540b79fd9cf1b - let request_id: [u8; 32] = + let mut request_id: [u8; 32] = hex::decode("b06aa45eb35423f988e36c022967b4c02bb719b037717df13fa57c0f503d8a20") .unwrap() .try_into() .unwrap(); + request_id.reverse(); + let mut quorum = Platform::::choose_quorum_v0( QuorumType::Llmq50_60, &quorums, @@ -294,12 +288,14 @@ mod tests { // llmqType[5] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000bd5639c21dd8abf60253c3fe0343d87a9762b5b8f57e2b4ea1523fd071 // llmqType[100] requestID[2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10] -> 000000dc07d722238a994116c3395c334211d9864ff5b37c3be51d5fdda66223 - let request_id: [u8; 32] = + let mut request_id: [u8; 32] = hex::decode("2fc41ef02a3216e4311805a9a11405a41a8d7a9f179526b4f6f2866bff009a10") .unwrap() .try_into() .unwrap(); + request_id.reverse(); + let mut quorum = Platform::::choose_quorum_v0( QuorumType::Llmq50_60, &quorums, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs index c0ddb466229..038a7365ac8 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/mod.rs @@ -21,6 +21,7 @@ where /// valid on platform. pub fn verify_chain_lock( &self, + round: u32, platform_state: &PlatformState, chain_lock: &ChainLock, make_sure_core_is_synced: bool, @@ -33,6 +34,7 @@ where .verify_chain_lock { 0 => self.verify_chain_lock_v0( + round, platform_state, chain_lock, make_sure_core_is_synced, diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs index 6609a738ac6..136ba114e0f 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock/v0/mod.rs @@ -20,13 +20,14 @@ where { pub(super) fn verify_chain_lock_v0( &self, + round: u32, platform_state: &PlatformState, chain_lock: &ChainLock, make_sure_core_is_synced: bool, platform_version: &PlatformVersion, ) -> Result { // first we try to verify the chain lock locally - match self.verify_chain_lock_locally(platform_state, chain_lock, platform_version) { + match self.verify_chain_lock_locally(round, platform_state, chain_lock, platform_version) { Ok(Some(valid)) => { if valid && make_sure_core_is_synced { match self.make_sure_core_is_synced_to_chain_lock(chain_lock, platform_version) diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs index ba5cb51581d..21df37ba30e 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/mod.rs @@ -20,6 +20,7 @@ where /// the quorum pub fn verify_chain_lock_locally( &self, + round: u32, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion, @@ -30,7 +31,12 @@ where .core_chain_lock .verify_chain_lock_locally { - 0 => self.verify_chain_lock_locally_v0(platform_state, chain_lock, platform_version), + 0 => self.verify_chain_lock_locally_v0( + round, + platform_state, + chain_lock, + platform_version, + ), version => Err(Error::Execution(ExecutionError::UnknownVersionMismatch { method: "verify_chain_lock_locally".to_string(), known_versions: vec![0], diff --git a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs index f5ed6e8bbc0..815532e8694 100644 --- a/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/platform_events/core_chain_lock/verify_chain_lock_locally/v0/mod.rs @@ -27,6 +27,7 @@ where /// the quorum pub fn verify_chain_lock_locally_v0( &self, + round: u32, platform_state: &PlatformState, chain_lock: &ChainLock, platform_version: &PlatformVersion, @@ -48,6 +49,16 @@ where let verification_height = chain_lock_height.saturating_sub(SIGN_OFFSET); if verification_height > last_block_in_window { + tracing::debug!( + ?chain_lock, + "h:{} r:{} skipped message_digest for chain lock at core height {} is {}, verification height {}, last block in window {}", + platform_state.last_committed_block_height() + 1, + round, + chain_lock.block_height, + platform_state.last_committed_core_height(), + verification_height, + last_block_in_window, + ); return Ok(None); // the chain lock is too far in the future or the past to verify locally } @@ -145,10 +156,11 @@ where let mut chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); - tracing::trace!( + tracing::debug!( ?chain_lock, - "h:{} message_digest for chain lock at core height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification window {}, last block in window {}", + "h:{} r:{} message_digest for chain lock at core height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}, last committed core height {}, verification height {}, last block in window {}", platform_state.last_committed_block_height() + 1, + round, chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), @@ -187,10 +199,11 @@ where chain_lock_verified = public_key.verify(&signature, message_digest.as_ref()); - tracing::trace!( + tracing::debug!( ?chain_lock, - "h:{} tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", + "h:{} r:{} tried second quorums message_digest for chain lock at height {} is {}, quorum hash is {}, block hash is {}, chain lock was {}", platform_state.last_committed_block_height() + 1, + round, chain_lock.block_height, hex::encode(message_digest.as_byte_array()), hex::encode(quorum_hash.as_slice()), @@ -198,7 +211,7 @@ where if chain_lock_verified { "verified"} else {"not verified"} ); if !chain_lock_verified { - tracing::error!( + tracing::debug!( "chain lock was invalid for both recent and old chain lock quorums" ); } @@ -207,17 +220,19 @@ where .is_none() { // we don't have old quorums, this means our node is very new. - tracing::trace!( + tracing::debug!( "we had no previous quorums locally, we should validate through core", ); return Ok(None); } else if !should_be_verifiable { - tracing::trace!( + tracing::debug!( "we were in a situation where it would be possible we didn't have all quorums and we couldn't verify locally, we should validate through core", ); return Ok(None); + } else if round >= 10 { + tracing::debug!("high round when chain lock was invalid, asking core to verify"); } else { - tracing::error!("chain lock was invalid, and we deemed there was no reason to check old quorums"); + tracing::debug!("chain lock was invalid, and we deemed there was no reason to check old quorums"); } } diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index 7c7bc25a789..cd30e86f456 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index af407ba56f1..92977293735 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index eeac7252a11..a2af6dfca3f 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 88c6cf41ff2..731069be8c2 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index c33bc38c49c..0e84f1c727d 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 21805cfab50..2048fc32cee 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index cdb95b1526a..56785f16042 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index 11025c10f0f..da5d0cb5c17 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 8e3c2619653..78aa330a881 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index 3107bb9b832..b6f323fd766 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index 2a7a8a1cb94..ac9b94d6c02 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index 0dfb7404de0..eba054bf3fa 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.8", + "version": "8.0.0-pr.1621.9", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index e808cc74d00..23f3a291d0e 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 9193b724ba2..5e26c181678 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index f1c93ddaf7b..2fab24675e7 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.8" +version = "1.0.0-pr.1621.9" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 83c76e85d55..6fe9fd9f196 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.8", + "version": "1.0.0-pr.1621.9", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "", From 3a11415bac5820a54e85535afa16c3bd937176a5 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Sun, 28 Jan 2024 07:04:07 -0800 Subject: [PATCH 51/51] reverted to dev.3 --- Cargo.lock | 46 +++++++++---------- package.json | 2 +- packages/bench-suite/package.json | 2 +- packages/dapi-grpc/Cargo.toml | 2 +- packages/dapi-grpc/package.json | 2 +- packages/dapi/package.json | 2 +- packages/dash-spv/package.json | 2 +- packages/dashmate/package.json | 2 +- packages/dashpay-contract/Cargo.toml | 2 +- packages/dashpay-contract/package.json | 2 +- packages/data-contracts/Cargo.toml | 2 +- packages/dpns-contract/Cargo.toml | 2 +- packages/dpns-contract/package.json | 2 +- packages/feature-flags-contract/Cargo.toml | 2 +- packages/feature-flags-contract/package.json | 2 +- packages/js-dapi-client/package.json | 2 +- packages/js-dash-sdk/package.json | 2 +- packages/js-grpc-common/package.json | 2 +- .../Cargo.toml | 2 +- .../package.json | 2 +- packages/platform-test-suite/package.json | 2 +- packages/rs-dapi-client/Cargo.toml | 2 +- packages/rs-dapi-grpc-macros/Cargo.toml | 2 +- packages/rs-dpp/Cargo.toml | 2 +- packages/rs-drive-abci/Cargo.toml | 2 +- packages/rs-drive-proof-verifier/Cargo.toml | 2 +- packages/rs-drive/Cargo.toml | 2 +- .../Cargo.toml | 2 +- packages/rs-platform-serialization/Cargo.toml | 2 +- .../rs-platform-value-convertible/Cargo.toml | 2 +- packages/rs-platform-value/Cargo.toml | 2 +- packages/rs-platform-version/Cargo.toml | 2 +- packages/rs-platform-versioning/Cargo.toml | 2 +- packages/rs-sdk/Cargo.toml | 2 +- packages/simple-signer/Cargo.toml | 2 +- packages/strategy-tests/Cargo.toml | 2 +- packages/wallet-lib/package.json | 2 +- packages/wasm-dpp/Cargo.toml | 2 +- packages/wasm-dpp/package.json | 2 +- packages/withdrawals-contract/Cargo.toml | 2 +- packages/withdrawals-contract/package.json | 2 +- 41 files changed, 63 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 116eb3dcb62..fb03b941466 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "dapi-grpc" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "dapi-grpc-macros", "platform-version", @@ -951,7 +951,7 @@ dependencies = [ [[package]] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "dapi-grpc", "heck", @@ -1057,7 +1057,7 @@ dependencies = [ [[package]] name = "dashpay-contract" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "platform-value", "serde_json", @@ -1065,7 +1065,7 @@ dependencies = [ [[package]] name = "data-contracts" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "dashpay-contract", "dpns-contract", @@ -1156,7 +1156,7 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "dpns-contract" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "platform-value", "serde_json", @@ -1164,7 +1164,7 @@ dependencies = [ [[package]] name = "dpp" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "anyhow", "async-trait", @@ -1214,7 +1214,7 @@ dependencies = [ [[package]] name = "drive" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "anyhow", "base64 0.21.7", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "drive-abci" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "atty", "base64 0.20.0", @@ -1303,7 +1303,7 @@ dependencies = [ [[package]] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "dapi-grpc", "dpp", @@ -1504,7 +1504,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "feature-flags-contract" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "platform-value", "serde_json", @@ -2361,7 +2361,7 @@ dependencies = [ [[package]] name = "masternode-reward-shares-contract" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "platform-value", "serde_json", @@ -2830,7 +2830,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platform-serialization" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "bincode 2.0.0-rc.3", "platform-version", @@ -2838,7 +2838,7 @@ dependencies = [ [[package]] name = "platform-serialization-derive" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "proc-macro2", "quote", @@ -2848,7 +2848,7 @@ dependencies = [ [[package]] name = "platform-value" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "base64 0.13.1", "bincode 2.0.0-rc.3", @@ -2869,7 +2869,7 @@ dependencies = [ [[package]] name = "platform-value-convertible" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "quote", "syn 2.0.48", @@ -2877,14 +2877,14 @@ dependencies = [ [[package]] name = "platform-version" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "thiserror", ] [[package]] name = "platform-versioning" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "proc-macro2", "quote", @@ -3426,7 +3426,7 @@ dependencies = [ [[package]] name = "rs-dapi-client" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "backon", "chrono", @@ -3446,7 +3446,7 @@ dependencies = [ [[package]] name = "rs-sdk" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "async-trait", "base64 0.21.7", @@ -3896,7 +3896,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-signer" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "anyhow", "bincode 2.0.0-rc.3", @@ -3987,7 +3987,7 @@ dependencies = [ [[package]] name = "strategy-tests" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "bincode 2.0.0-rc.3", "dpp", @@ -4841,7 +4841,7 @@ checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] name = "wasm-dpp" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "anyhow", "async-trait", @@ -5083,7 +5083,7 @@ dependencies = [ [[package]] name = "withdrawals-contract" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" dependencies = [ "num_enum", "platform-value", diff --git a/package.json b/package.json index b14815ccafb..9367ba41abe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/platform", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "private": true, "scripts": { "setup": "yarn install && yarn run build && yarn run configure", diff --git a/packages/bench-suite/package.json b/packages/bench-suite/package.json index 79d20826dad..3d249a0e74e 100644 --- a/packages/bench-suite/package.json +++ b/packages/bench-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/bench-suite", "private": true, - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Dash Platform benchmark tool", "scripts": { "bench": "node ./bin/bench.js", diff --git a/packages/dapi-grpc/Cargo.toml b/packages/dapi-grpc/Cargo.toml index dc4bab480df..5936b3fce84 100644 --- a/packages/dapi-grpc/Cargo.toml +++ b/packages/dapi-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc" description = "GRPC client for Dash Platform" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" authors = [ "Samuel Westrich ", "Igor Markin ", diff --git a/packages/dapi-grpc/package.json b/packages/dapi-grpc/package.json index 362c65ef940..520e07d8857 100644 --- a/packages/dapi-grpc/package.json +++ b/packages/dapi-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-grpc", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "DAPI GRPC definition file and generated clients", "browser": "browser.js", "main": "node.js", diff --git a/packages/dapi/package.json b/packages/dapi/package.json index 21b7ccd10c5..982f6b9312d 100644 --- a/packages/dapi/package.json +++ b/packages/dapi/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/dapi", "private": true, - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "A decentralized API for the Dash network", "scripts": { "api": "node scripts/api.js", diff --git a/packages/dash-spv/package.json b/packages/dash-spv/package.json index 1bae9fbd5ac..90a85daeae4 100644 --- a/packages/dash-spv/package.json +++ b/packages/dash-spv/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dash-spv", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Repository containing SPV functions used by @dashevo", "main": "index.js", "scripts": { diff --git a/packages/dashmate/package.json b/packages/dashmate/package.json index 652a1927c70..eddc62b2a02 100644 --- a/packages/dashmate/package.json +++ b/packages/dashmate/package.json @@ -1,6 +1,6 @@ { "name": "dashmate", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Distribution package for Dash node installation", "scripts": { "lint": "eslint .", diff --git a/packages/dashpay-contract/Cargo.toml b/packages/dashpay-contract/Cargo.toml index d09fb140d5c..ea69f871c89 100644 --- a/packages/dashpay-contract/Cargo.toml +++ b/packages/dashpay-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dashpay-contract" description = "DashPay data contract schema and tools" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dashpay-contract/package.json b/packages/dashpay-contract/package.json index c2b8c280894..b159d7d7e9a 100644 --- a/packages/dashpay-contract/package.json +++ b/packages/dashpay-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dashpay-contract", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Reference contract of the DashPay DPA on Dash Evolution", "scripts": { "lint": "eslint .", diff --git a/packages/data-contracts/Cargo.toml b/packages/data-contracts/Cargo.toml index 2d668a752d3..9ca1fc9250c 100644 --- a/packages/data-contracts/Cargo.toml +++ b/packages/data-contracts/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "data-contracts" description = "Dash Platform system data contracts" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/Cargo.toml b/packages/dpns-contract/Cargo.toml index 2579bfda02b..4b1156421ae 100644 --- a/packages/dpns-contract/Cargo.toml +++ b/packages/dpns-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dpns-contract" description = "DPNS data contract schema and tools" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/dpns-contract/package.json b/packages/dpns-contract/package.json index a4a7b19eec0..6443f17ec1f 100644 --- a/packages/dpns-contract/package.json +++ b/packages/dpns-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dpns-contract", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "A contract and helper scripts for DPNS DApp", "scripts": { "lint": "eslint .", diff --git a/packages/feature-flags-contract/Cargo.toml b/packages/feature-flags-contract/Cargo.toml index 66f727ca342..d7fc4fcabf7 100644 --- a/packages/feature-flags-contract/Cargo.toml +++ b/packages/feature-flags-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "feature-flags-contract" description = "Feature flags data contract schema and tools" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/feature-flags-contract/package.json b/packages/feature-flags-contract/package.json index a5a64b038ab..016df4eed22 100644 --- a/packages/feature-flags-contract/package.json +++ b/packages/feature-flags-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/feature-flags-contract", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Data Contract to store Dash Platform feature flags", "scripts": { "build": "", diff --git a/packages/js-dapi-client/package.json b/packages/js-dapi-client/package.json index e4b9979a3b8..7567d81fa9d 100644 --- a/packages/js-dapi-client/package.json +++ b/packages/js-dapi-client/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/dapi-client", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Client library used to access Dash DAPI endpoints", "main": "lib/index.js", "contributors": [ diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 0ae612a6a4e..78da9c3cb84 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -1,6 +1,6 @@ { "name": "dash", - "version": "4.0.0-pr.1621.9", + "version": "4.0.0-dev.3", "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)", "main": "build/index.js", "unpkg": "dist/dash.min.js", diff --git a/packages/js-grpc-common/package.json b/packages/js-grpc-common/package.json index 97ac8224f93..1c5851b75b6 100644 --- a/packages/js-grpc-common/package.json +++ b/packages/js-grpc-common/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/grpc-common", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Common GRPC library", "main": "index.js", "scripts": { diff --git a/packages/masternode-reward-shares-contract/Cargo.toml b/packages/masternode-reward-shares-contract/Cargo.toml index 6f5d5531eda..29a0bc18512 100644 --- a/packages/masternode-reward-shares-contract/Cargo.toml +++ b/packages/masternode-reward-shares-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "masternode-reward-shares-contract" description = "Masternode reward shares data contract schema and tools" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/masternode-reward-shares-contract/package.json b/packages/masternode-reward-shares-contract/package.json index 99d9fe2e478..940d19628c0 100644 --- a/packages/masternode-reward-shares-contract/package.json +++ b/packages/masternode-reward-shares-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/masternode-reward-shares-contract", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "A contract and helper scripts for reward sharing", "scripts": { "lint": "eslint .", diff --git a/packages/platform-test-suite/package.json b/packages/platform-test-suite/package.json index f4e90a498d5..d07d51f736b 100644 --- a/packages/platform-test-suite/package.json +++ b/packages/platform-test-suite/package.json @@ -1,7 +1,7 @@ { "name": "@dashevo/platform-test-suite", "private": true, - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Dash Network end-to-end tests", "scripts": { "test": "yarn exec bin/test.sh", diff --git a/packages/rs-dapi-client/Cargo.toml b/packages/rs-dapi-client/Cargo.toml index 7aa8f1cca5b..ae68cf9d3e5 100644 --- a/packages/rs-dapi-client/Cargo.toml +++ b/packages/rs-dapi-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-dapi-client" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" [features] diff --git a/packages/rs-dapi-grpc-macros/Cargo.toml b/packages/rs-dapi-grpc-macros/Cargo.toml index f94d0afc265..198feae7275 100644 --- a/packages/rs-dapi-grpc-macros/Cargo.toml +++ b/packages/rs-dapi-grpc-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dapi-grpc-macros" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" description = "Macros used by dapi-grpc. Internal use only." diff --git a/packages/rs-dpp/Cargo.toml b/packages/rs-dpp/Cargo.toml index a5a816862a9..f952233c4d7 100644 --- a/packages/rs-dpp/Cargo.toml +++ b/packages/rs-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dpp" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" authors = [ diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 3cac2b38f5b..ea9f1bf5658 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-abci" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-drive-proof-verifier/Cargo.toml b/packages/rs-drive-proof-verifier/Cargo.toml index cd30e86f456..3b42107d9e7 100644 --- a/packages/rs-drive-proof-verifier/Cargo.toml +++ b/packages/rs-drive-proof-verifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drive-proof-verifier" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" diff --git a/packages/rs-drive/Cargo.toml b/packages/rs-drive/Cargo.toml index 92977293735..a0cda6ef577 100644 --- a/packages/rs-drive/Cargo.toml +++ b/packages/rs-drive/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "drive" description = "Dash drive built on top of GroveDB" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/rs-platform-serialization-derive/Cargo.toml b/packages/rs-platform-serialization-derive/Cargo.toml index a2af6dfca3f..01c46b7fbcf 100644 --- a/packages/rs-platform-serialization-derive/Cargo.toml +++ b/packages/rs-platform-serialization-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization-derive" authors = ["Samuel Westrich "] description = "Bincode serialization and deserialization derivations" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-serialization/Cargo.toml b/packages/rs-platform-serialization/Cargo.toml index 731069be8c2..01efda71698 100644 --- a/packages/rs-platform-serialization/Cargo.toml +++ b/packages/rs-platform-serialization/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-serialization" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value-convertible/Cargo.toml b/packages/rs-platform-value-convertible/Cargo.toml index 0e84f1c727d..85da3f10c0b 100644 --- a/packages/rs-platform-value-convertible/Cargo.toml +++ b/packages/rs-platform-value-convertible/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value-convertible" authors = ["Samuel Westrich "] description = "Convertion to and from platform values" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-value/Cargo.toml b/packages/rs-platform-value/Cargo.toml index 2048fc32cee..f27e33cca8b 100644 --- a/packages/rs-platform-value/Cargo.toml +++ b/packages/rs-platform-value/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-value" authors = ["Samuel Westrich "] description = "A simple value module" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-version/Cargo.toml b/packages/rs-platform-version/Cargo.toml index 56785f16042..456e152e888 100644 --- a/packages/rs-platform-version/Cargo.toml +++ b/packages/rs-platform-version/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-version" authors = ["Samuel Westrich "] description = "Bincode based serialization and deserialization" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-platform-versioning/Cargo.toml b/packages/rs-platform-versioning/Cargo.toml index da5d0cb5c17..fc197caa00a 100644 --- a/packages/rs-platform-versioning/Cargo.toml +++ b/packages/rs-platform-versioning/Cargo.toml @@ -2,7 +2,7 @@ name = "platform-versioning" authors = ["Samuel Westrich "] description = "Version derivation" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/rs-sdk/Cargo.toml b/packages/rs-sdk/Cargo.toml index 78aa330a881..0712383f300 100644 --- a/packages/rs-sdk/Cargo.toml +++ b/packages/rs-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs-sdk" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" [dependencies] diff --git a/packages/simple-signer/Cargo.toml b/packages/simple-signer/Cargo.toml index b6f323fd766..66abcd42f99 100644 --- a/packages/simple-signer/Cargo.toml +++ b/packages/simple-signer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simple-signer" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" diff --git a/packages/strategy-tests/Cargo.toml b/packages/strategy-tests/Cargo.toml index ac9b94d6c02..f78a30a8a03 100644 --- a/packages/strategy-tests/Cargo.toml +++ b/packages/strategy-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "strategy-tests" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" authors = [ "Samuel Westrich ", "Ivan Shumkov ", diff --git a/packages/wallet-lib/package.json b/packages/wallet-lib/package.json index eba054bf3fa..4795d046767 100644 --- a/packages/wallet-lib/package.json +++ b/packages/wallet-lib/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wallet-lib", - "version": "8.0.0-pr.1621.9", + "version": "8.0.0-dev.3", "description": "Light wallet library for Dash", "main": "src/index.js", "unpkg": "dist/wallet-lib.min.js", diff --git a/packages/wasm-dpp/Cargo.toml b/packages/wasm-dpp/Cargo.toml index 23f3a291d0e..fccb89012ee 100644 --- a/packages/wasm-dpp/Cargo.toml +++ b/packages/wasm-dpp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm-dpp" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" authors = ["Anton Suprunchuk "] diff --git a/packages/wasm-dpp/package.json b/packages/wasm-dpp/package.json index 5e26c181678..7dd92cab9cc 100644 --- a/packages/wasm-dpp/package.json +++ b/packages/wasm-dpp/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/wasm-dpp", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "The JavaScript implementation of the Dash Platform Protocol", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/withdrawals-contract/Cargo.toml b/packages/withdrawals-contract/Cargo.toml index 2fab24675e7..c0e4c43fa90 100644 --- a/packages/withdrawals-contract/Cargo.toml +++ b/packages/withdrawals-contract/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "withdrawals-contract" description = "Witdrawals data contract schema and tools" -version = "1.0.0-pr.1621.9" +version = "1.0.0-dev.3" edition = "2021" rust-version = "1.73" license = "MIT" diff --git a/packages/withdrawals-contract/package.json b/packages/withdrawals-contract/package.json index 6fe9fd9f196..b5b7b083c11 100644 --- a/packages/withdrawals-contract/package.json +++ b/packages/withdrawals-contract/package.json @@ -1,6 +1,6 @@ { "name": "@dashevo/withdrawals-contract", - "version": "1.0.0-pr.1621.9", + "version": "1.0.0-dev.3", "description": "Data Contract to manipulate and track withdrawals", "scripts": { "build": "",