From 2b01ffc71c0f0e9f1efbe9172fc3af480a20c93b Mon Sep 17 00:00:00 2001 From: Greg Nazario Date: Mon, 20 May 2024 13:34:12 -0700 Subject: [PATCH] [api] Change block APIs to by default return all transactions The block size has a limit, and therefore, the limit has a limit, where the transactions API would likely be more variable. Therefore, it should be fine to make the block API return the entire block. --- api/src/context.rs | 2 +- config/src/config/api_config.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/src/context.rs b/api/src/context.rs index 7535e8faceb76..496d357f1d25b 100644 --- a/api/src/context.rs +++ b/api/src/context.rs @@ -576,7 +576,7 @@ impl Context { // We can only get the max_transactions page size let max_txns = std::cmp::min( - self.node_config.api.max_transactions_page_size, + self.node_config.api.max_block_transactions_page_size, (last_version - first_version + 1) as u16, ); let txns = if with_transactions { diff --git a/config/src/config/api_config.rs b/config/src/config/api_config.rs index 4fa20a6f52b25..65e202a457cf1 100644 --- a/config/src/config/api_config.rs +++ b/config/src/config/api_config.rs @@ -6,7 +6,7 @@ use super::transaction_filter_type::{Filter, Matcher}; use crate::{ config::{ config_sanitizer::ConfigSanitizer, gas_estimation_config::GasEstimationConfig, - node_config_loader::NodeType, Error, NodeConfig, + node_config_loader::NodeType, Error, NodeConfig, MAX_SENDING_BLOCK_TXNS, }, utils, }; @@ -53,6 +53,8 @@ pub struct ApiConfig { pub max_submit_transaction_batch_size: usize, /// Maximum page size for transaction paginated APIs pub max_transactions_page_size: u16, + /// Maximum page size for block transaction APIs + pub max_block_transactions_page_size: u16, /// Maximum page size for event paginated APIs pub max_events_page_size: u16, /// Maximum page size for resource paginated APIs @@ -123,6 +125,7 @@ impl Default for ApiConfig { transaction_submission_enabled: default_enabled(), transaction_simulation_enabled: default_enabled(), max_submit_transaction_batch_size: DEFAULT_MAX_SUBMIT_TRANSACTION_BATCH_SIZE, + max_block_transactions_page_size: MAX_SENDING_BLOCK_TXNS as u16, max_transactions_page_size: DEFAULT_MAX_PAGE_SIZE, max_events_page_size: DEFAULT_MAX_PAGE_SIZE, max_account_resources_page_size: DEFAULT_MAX_ACCOUNT_RESOURCES_PAGE_SIZE,