Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] Change block APIs to by default return all transactions #13365

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion config/src/config/api_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call me crazy but is u16 too small? I can imagine a world where MAX_SENDING_BLOCK_TXNS is larger than u16 max. Maybe either make this u32 or cast MAX_SENDING_BLOCK_TXNS to u16 safely (ceil).

/// Maximum page size for event paginated APIs
pub max_events_page_size: u16,
/// Maximum page size for resource paginated APIs
Expand Down Expand Up @@ -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,
Expand Down
Loading