Skip to content

Commit

Permalink
remove the unnecessary checking
Browse files Browse the repository at this point in the history
  • Loading branch information
shelmesky committed Apr 23, 2024
1 parent 7799325 commit 443a656
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 3 additions & 3 deletions crates/rooch-rpc-server/src/server/rooch_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use std::cmp::min;
use std::str::FromStr;
use tracing::info;

const MAX_RESULT_AMOUNT: u64 = 10000000;
const MAX_RESULT_AMOUNT: u64 = 10000;

pub struct RoochServer {
rpc_service: RpcService,
Expand Down Expand Up @@ -406,7 +406,7 @@ impl RoochAPIServer for RoochServer {
))?;
if gaps > MAX_RESULT_AMOUNT {
return Err(jsonrpsee::core::Error::Custom(
"end value is overflow".to_string(),
"amount of the result is too large".to_string(),
));
}

Expand All @@ -433,7 +433,7 @@ impl RoochAPIServer for RoochServer {
))?;
if gaps > MAX_RESULT_AMOUNT {
return Err(jsonrpsee::core::Error::Custom(
"end value is overflow".to_string(),
"amount of the result is too large".to_string(),
));
}

Expand Down
10 changes: 0 additions & 10 deletions crates/rooch-store/src/transaction_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use raw_store::CodecKVStore;
use raw_store::{derive_store, StoreInstance};
use rooch_types::transaction::LedgerTransaction;

const MAX_RESULT_AMOUNT: u64 = 10000000;

derive_store!(
LedgerTransactionStore,
H256,
Expand Down Expand Up @@ -37,14 +35,6 @@ pub trait TransactionStore {
let start = cursor.unwrap_or(0);
let end = start + limit;

let gaps = match end.checked_sub(start) {
None => return Err(anyhow::Error::msg("end value is overflow")),
Some(v) => v,
};
if gaps > MAX_RESULT_AMOUNT {
return Err(anyhow::Error::msg("end value is overflow"));
}

// Since tx order is strictly incremental, traversing the SMT Tree can be optimized into a multi get query to improve query performance.
let tx_orders: Vec<_> = if cursor.is_some() {
((start + 1)..=end).collect()
Expand Down

0 comments on commit 443a656

Please sign in to comment.