From 501a665ee7f52d71221370ae4d48220c15f1737d Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Wed, 18 Sep 2024 23:06:09 +0700 Subject: [PATCH 1/2] chore/changeUpgrade4EpochsLater --- .../src/execution/engine/consensus_params_update/v0/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/execution/engine/consensus_params_update/v0/mod.rs b/packages/rs-drive-abci/src/execution/engine/consensus_params_update/v0/mod.rs index 1fc6894497..608fb7cc39 100644 --- a/packages/rs-drive-abci/src/execution/engine/consensus_params_update/v0/mod.rs +++ b/packages/rs-drive-abci/src/execution/engine/consensus_params_update/v0/mod.rs @@ -30,7 +30,7 @@ pub(super) fn consensus_params_update_v0( } } Network::Testnet => { - if epoch_info.is_first_block_of_epoch(1476) { + if epoch_info.is_first_block_of_epoch(1480) { return Some(ConsensusParams { block: None, evidence: None, From a6367c2e6e784bb3575dd376faf97e26dcdd98f0 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 19 Sep 2024 16:37:20 +0700 Subject: [PATCH 2/2] fix: add limits to queries --- packages/rs-drive-abci/src/error/query.rs | 4 ++++ .../proposed_block_counts_by_evonode_ids/v0/mod.rs | 8 ++++++++ packages/rs-drive/src/drive/identity/fetch/mod.rs | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/rs-drive-abci/src/error/query.rs b/packages/rs-drive-abci/src/error/query.rs index 0a6e931703..ba60b25379 100644 --- a/packages/rs-drive-abci/src/error/query.rs +++ b/packages/rs-drive-abci/src/error/query.rs @@ -40,6 +40,10 @@ pub enum QueryError { #[error("invalid argument error: {0}")] InvalidArgument(String), + /// Too many elements Error + #[error("too many elements error: {0}")] + TooManyElements(String), + /// Not found Error #[error("not found error: {0}")] NotFound(String), diff --git a/packages/rs-drive-abci/src/query/validator_queries/proposed_block_counts_by_evonode_ids/v0/mod.rs b/packages/rs-drive-abci/src/query/validator_queries/proposed_block_counts_by_evonode_ids/v0/mod.rs index 28ccfbbe9d..6780b1a690 100644 --- a/packages/rs-drive-abci/src/query/validator_queries/proposed_block_counts_by_evonode_ids/v0/mod.rs +++ b/packages/rs-drive-abci/src/query/validator_queries/proposed_block_counts_by_evonode_ids/v0/mod.rs @@ -21,6 +21,14 @@ impl Platform { platform_state: &PlatformState, platform_version: &PlatformVersion, ) -> Result, Error> { + if ids.len() > self.config.drive.max_query_limit as usize { + return Ok(QueryValidationResult::new_with_error( + QueryError::TooManyElements(format!( + "this query only supports up to {} ids at a time", + ids.len() + )), + )); + } let evonode_ids = check_validation_result_with_data!(ids .into_iter() .map(|evonode_id_vec| { diff --git a/packages/rs-drive/src/drive/identity/fetch/mod.rs b/packages/rs-drive/src/drive/identity/fetch/mod.rs index 78bdd9c90f..79270a3569 100644 --- a/packages/rs-drive/src/drive/identity/fetch/mod.rs +++ b/packages/rs-drive/src/drive/identity/fetch/mod.rs @@ -180,7 +180,7 @@ impl Drive { path: vec![vec![RootTree::Balances as u8]], query: SizedQuery { query, - limit: None, + limit: Some(self.config.max_query_limit), offset: None, }, };