Skip to content

chore: unify and revisit query limits#1443

Merged
SantiagoPittella merged 7 commits intonextfrom
santiagopittella-unify-limits
Dec 17, 2025
Merged

chore: unify and revisit query limits#1443
SantiagoPittella merged 7 commits intonextfrom
santiagopittella-unify-limits

Conversation

@SantiagoPittella
Copy link
Collaborator

closes #1389

Centralized limits for the store and rpc queries.

@SantiagoPittella SantiagoPittella force-pushed the santiagopittella-unify-limits branch from 00af4bc to c1d22df Compare December 10, 2025 18:25
@SantiagoPittella SantiagoPittella force-pushed the santiagopittella-unify-limits branch from c1d22df to 8d7b031 Compare December 11, 2025 12:46
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left just a few small comments inline.

@bobbinth bobbinth requested a review from igamigo December 16, 2025 23:35
Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

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

LGTM! As we talked offline, if this gets merged we should update the limits on the client, so we should open an issue or a PR directly since it would be a very simple change anyway.

Also, one question: if get_notes_by_id returns 1000 notes (the limit), could it not potentially be above the maximum current response payload size?

CHANGELOG.md Outdated
- [BREAKING] Added block signing capabilities to Validator component and updated gensis bootstrap to sign blocks with configured signer ([#1426](https://github.com/0xMiden/miden-node/pull/1426)).
- Reduced default block interval from `5s` to `2s` ([#1438](https://github.com/0xMiden/miden-node/pull/1438)).
- Increased retained account tree history from 33 to 100 blocks to account for the reduced block interval ([#1438](https://github.com/0xMiden/miden-node/pull/1438)).
- Increased the maximum query limit for the store ([#1443](https://github.com/0xMiden/miden-node/pull/1443))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit for consistency:

Suggested change
- Increased the maximum query limit for the store ([#1443](https://github.com/0xMiden/miden-node/pull/1443))
- Increased the maximum query limit for the store ([#1443](https://github.com/0xMiden/miden-node/pull/1443)).

//! 1. the external facing RPC
//! 2. limiting SQL statements not exceeding parameter limits
//! # Rationale
//! - Parameter limits are kept at 1000 items across all multi-value RPC parameters. This caps
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to reference the 1000 const here? So that the doc comment does not accidentally drift if it gets updated

@SantiagoPittella
Copy link
Collaborator Author

LGTM! As we talked offline, if this gets merged we should update the limits on the client, so we should open an issue or a PR directly since it would be a very simple change anyway.

Yes! I'm planning to open a PR for that when this gets merged.

Also, one question: if get_notes_by_id returns 1000 notes (the limit), could it not potentially be above the maximum current response payload size?

You could request for up to 1000 notes but if the limit is reached you will need to request the "next page"

@SantiagoPittella SantiagoPittella force-pushed the santiagopittella-unify-limits branch from ba4b31d to d7d7320 Compare December 17, 2025 15:42
@SantiagoPittella SantiagoPittella merged commit a03124e into next Dec 17, 2025
6 checks passed
@SantiagoPittella SantiagoPittella deleted the santiagopittella-unify-limits branch December 17, 2025 15:51
@SantiagoPittella
Copy link
Collaborator Author

As @igamigo point me out, get_notes_by_id is not paginated. And from my approximation, a single note can ended up taking too much space in the worst case scenario, over 1 MB. So the 1000 limit can be way to large. Should I reduce it? I don't know how large notes usually are. cc @bobbinth

Comment on lines +45 to +47
/// Maximum payload size (in bytes) for paginated responses returned by the
/// store.
pub const MAX_RESPONSE_PAYLOAD_BYTES: usize = 4 * 1024 * 1024;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the comment here needs to be updated as well.

@bobbinth
Copy link
Contributor

bobbinth commented Dec 18, 2025

As @igamigo point me out, get_notes_by_id is not paginated. And from my approximation, a single note can ended up taking too much space in the worst case scenario, over 1 MB. So the 1000 limit can be way to large. Should I reduce it? I don't know how large notes usually are. cc @bobbinth

A single note shouldn't end up being that big. Right now, a note may have up to 1024 input elements (8KB), and we'll probably need to impose script size limit on a note, and we'll also soon have "note attachments", which we'll also probably limit to 8KB or 16KB.

Overall, maybe we impose a general limit on the size of a note to be something like 32KB (@PhilippGackstatter - let's create an issue for this if we don't have one yet). At this limit, we could allow up to 100 notes. So, let's reduce the limit on this endpoint to 100.

@bobbinth
Copy link
Contributor

Separately, it may be good to also include limits in the RPC endpoint docs. Let's create another issue for this (unless we already have one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Param limit mismatch between RPC and Store component

3 participants