Skip to content

feat(pxe)!: add source and block-range filtering to get_logs_by_tag#23326

Merged
nchamo merged 8 commits into
merge-train/fairiesfrom
nchamo/f-657-add-fromto-block-range-filtering-to-get_logs_by_tag
May 21, 2026
Merged

feat(pxe)!: add source and block-range filtering to get_logs_by_tag#23326
nchamo merged 8 commits into
merge-train/fairiesfrom
nchamo/f-657-add-fromto-block-range-filtering-to-get_logs_by_tag

Conversation

@nchamo

@nchamo nchamo commented May 15, 2026

Copy link
Copy Markdown
Contributor

Why

Constrained delivery introduces log tags that can be repeated across multiple logs and that only appear on private logs. The current get_logs_by_tag oracle returns at most one log per tag and always queries both private and public RPCs, which doesn't work for this use case:

  • Repeated tags mean we need to return multiple logs per tag, not just the first match
  • Without block-range filtering, re-scanning the same tag range returns previously seen logs — from_block/to_block let callers scope queries to new blocks only
  • Some tags are private-only, so querying both RPCs is wasteful — a source filter lets callers specify private, public, or both

Our fix

  • Extend LogRetrievalRequest with source, from_block, and to_block fields across the Noir-TS boundary
  • Change fetchLogsByTag to return all matching logs per tag (LogRetrievalResponse[][]) instead of only the first match
  • Add LogSource enum (private / public / public-and-private) following the repo's struct-based enum pattern, with validation on TS deserialization
  • Block range uses half-open [fromBlock, toBlock) semantics to match AztecNode conventions
  • Client-side filtering for now; push-down to the node layer is tracked separately (F-650)

Fixes F-657
Fixes #15052

@nchamo nchamo requested a review from nventuro as a code owner May 15, 2026 21:03
@nchamo nchamo self-assigned this May 15, 2026
@nchamo nchamo changed the title feat(pxe): add source and block-range filtering to get_logs_by_tag feat!(pxe): add source and block-range filtering to get_logs_by_tag May 15, 2026
@nchamo nchamo changed the title feat!(pxe): add source and block-range filtering to get_logs_by_tag feat(pxe)!: add source and block-range filtering to get_logs_by_tag May 15, 2026
/// without actually using any of the new oracles then there is no reason to throw.
pub global ORACLE_VERSION_MAJOR: Field = 22;
pub global ORACLE_VERSION_MINOR: Field = 1;
pub global ORACLE_VERSION_MAJOR: Field = 23;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would have expected this to be 12 (the version we decided protocol contracts were going to use), but apparently we are keeping it up to date with PXE's version

@nchamo nchamo requested review from mverzilli and vezenovm May 15, 2026 22:20
Comment on lines +21 to +23
+ source: LogSource.PUBLIC_AND_PRIVATE,
+ from_block: Option::none(),
+ to_block: Option::none(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would it make sense to add a default constructor?

Comment on lines +699 to +700
// The deprecated v1 oracle expects Option<LogRetrievalResponse> (at most one per tag).
const maybeLogRetrievalResponses = logRetrievalResponses.map(logs => logs[0] ?? null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know we're deprecating this soon, but maybe add a unit tests for this case

@AztecBot

AztecBot commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/64269976fc555dba�64269976fc555dba8;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/multiple_validators_sentinel.parallel.test.ts "collects attestations for all validators on a node" (338s) (code: 0) group:e2e-p2p-epoch-flakes

@nchamo nchamo requested a review from mverzilli May 21, 2026 10:12
@nchamo nchamo enabled auto-merge (squash) May 21, 2026 13:23
@nchamo nchamo merged commit ede2dec into merge-train/fairies May 21, 2026
14 checks passed
@nchamo nchamo deleted the nchamo/f-657-add-fromto-block-range-filtering-to-get_logs_by_tag branch May 21, 2026 13:42
github-merge-queue Bot pushed a commit that referenced this pull request May 25, 2026
BEGIN_COMMIT_OVERRIDE
feat(txe): add TXE oracle version check to bootstrap (#23324)
fix(txe): correct TXE_ORACLE_INTERFACE_HASH to match current oracle
interface (#23460)
feat(aztec-nr): add Serialize/Deserialize for EphemeralArray (#23417)
refactor: move validation and error handling out of transport layer
(#23422)
feat(pxe)!: add source and block-range filtering to get_logs_by_tag
(#23326)
fix(txe): update TXE oracle interface hash for new AVM oracle methods
(#23492)
chore(ci): capture sandbox diagnostics on acceptance test failure
(#23495)
feat(aztec-nr)!: rename push_nullifier to push_nullifier_unsafe (#23488)
feat(aztec-nr)!: add explicit custom_sync_state hook to AztecConfig
(#23446)
fix(ci): skip aztec-cli notify job when acceptance test is skipped
(#23534)
fix: released contract artifact aztec version (forward port of #23470)
(#23500)
fix: merge train conflicts (#23548)
END_COMMIT_OVERRIDE
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.

3 participants