Skip to content

Commit

Permalink
[api] Reduce default page size to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario committed Oct 4, 2022
1 parent c2e3c35 commit 71bbe54
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"message": "Given limit value (2000) is too large, it must be < 1000",
"message": "Given limit value (2000) is too large, it must be <= 100",
"error_code": "invalid_input",
"vm_error_code": null
}
2 changes: 1 addition & 1 deletion api/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Page {
if limit > self.max_page_size {
return Err(E::bad_request_with_code(
&format!(
"Given limit value ({}) is too large, it must be < {}",
"Given limit value ({}) is too large, it must be <= {}",
limit, self.max_page_size
),
AptosErrorCode::InvalidInput,
Expand Down
2 changes: 1 addition & 1 deletion config/src/config/api_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub const DEFAULT_ADDRESS: &str = "127.0.0.1";
pub const DEFAULT_PORT: u16 = 8080;
pub const DEFAULT_REQUEST_CONTENT_LENGTH_LIMIT: u64 = 8 * 1024 * 1024; // 8 MB
pub const DEFAULT_MAX_SUBMIT_TRANSACTION_BATCH_SIZE: usize = 10;
pub const DEFAULT_MAX_PAGE_SIZE: u16 = 1000;
pub const DEFAULT_MAX_PAGE_SIZE: u16 = 100;

fn default_enabled() -> bool {
true
Expand Down
2 changes: 1 addition & 1 deletion crates/aptos/src/node/analyze/analyze_validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub struct AnalyzeValidators {}
impl AnalyzeValidators {
/// Fetch all events from a single epoch from DB.
pub fn fetch_epoch(epoch: u64, aptos_db: &dyn DbReader) -> Result<Vec<VersionedNewBlockEvent>> {
let batch = 1000;
let batch = 100;

let mut cursor = u64::max_value();
let mut result: Vec<VersionedNewBlockEvent> = vec![];
Expand Down
2 changes: 1 addition & 1 deletion crates/aptos/src/node/analyze/fetch_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl FetchMetadata {
}
}

let batch: u16 = 1000;
let batch: u16 = 100;
let mut batch_index = 0;

println!(
Expand Down
12 changes: 8 additions & 4 deletions testsuite/forge/src/test_utils/consensus_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use anyhow::{bail, Context, Result};
use aptos_config::config::DEFAULT_MAX_PAGE_SIZE;
use aptos_rest_client::Client as RestClient;
use async_trait::async_trait;
use chrono::Utc;
Expand Down Expand Up @@ -165,10 +166,13 @@ pub async fn test_consensus_fault_tolerance(
let transactions: Vec<_> =
join_all(validator_clients.iter().cloned().map(move |v| async move {
let mut txns =
v.1.get_transactions_bcs(Some(target_v.saturating_sub(1000)), Some(1000))
.await
.unwrap()
.into_inner();
v.1.get_transactions_bcs(
Some(target_v.saturating_sub(DEFAULT_MAX_PAGE_SIZE as u64)),
Some(DEFAULT_MAX_PAGE_SIZE),
)
.await
.unwrap()
.into_inner();
txns.retain(|t| t.version <= target_v);
<Result<Vec<_>>>::Ok(txns)
}))
Expand Down

0 comments on commit 71bbe54

Please sign in to comment.