Skip to content

feat: make node.getContract take an optional reference block - #24207

Merged
nventuro merged 4 commits into
merge-train/fairies-v5from
spl/get-contract-optional-reference-block
Jun 22, 2026
Merged

feat: make node.getContract take an optional reference block#24207
nventuro merged 4 commits into
merge-train/fairies-v5from
spl/get-contract-optional-reference-block

Conversation

@spalladino

@spalladino spalladino commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

PXE needs the class id at the anchor block, but the node only exposed the latest one. This forced PXE to reimplement the class id detection by raw reads of the trees combined with delayed public mutable interpretation of said data, which unnecessarily coupled PXE and the registry contracts. With this PR we simply query the data from the node, which will always be available if there's an upgrade, making the original class a safe fallback.

The new referenceBlock argument is optional and defaults to 'latest', with address kept as the first argument, so the change is backwards compatible: existing single-argument getContract(address) callers keep working unchanged, and only PXE's class-id resolution passes an explicit anchor block.

Supersedes #24205, addressing the review feedback to make the new argument optional.

Fixes #15170

nventuro and others added 3 commits June 19, 2026 19:57
Flip the getContract arguments so address comes first and referenceBlock is an
optional trailing parameter defaulting to 'latest'. This keeps the change
backwards compatible: existing single-argument callers keep working, and only
the PXE class-id resolution passes an explicit anchor block.
@spalladino
spalladino requested a review from a team as a code owner June 19, 2026 22:58
Resolves the TODO(#15170) in the ContractDataSource interface: the timestamp
parameter is now required rather than optional, and the archiver implementations
no longer silently fall back to the latest proposed block when it is omitted.
Callers that want the latest state now resolve and pass the timestamp explicitly.
@spalladino
spalladino requested a review from nventuro June 19, 2026 23:19
@nventuro
nventuro merged commit e0add37 into merge-train/fairies-v5 Jun 22, 2026
15 checks passed
@nventuro
nventuro deleted the spl/get-contract-optional-reference-block branch June 22, 2026 13:12
AztecBot added a commit that referenced this pull request Jun 26, 2026
merge-train/spartan-v5 has landed in v5-next and auto-pulled into this train.
Its server.ts refactor (#24283) rewrote the imports and dropped
inspectBlockParameter, but this train's getContract change (#24207) still
calls it in the reference-block-not-found error, so the merged server.ts
references an unimported symbol and the yarn-project build fails. Re-add
inspectBlockParameter to the existing @aztec/stdlib/block import.
mverzilli added a commit that referenced this pull request Jun 26, 2026
## Why

`merge-train/spartan-v5`
([#24272](#24272))
has landed in `v5-next` and been auto-pulled into this train (merge
commit `34209c32`), so the cross-train build break is now live on the
`merge-train/fairies-v5` tip itself — `yarn-project` no longer compiles
(`make: *** [Makefile:359: yarn-project] Error 1`, in `compile_all`).

## Root cause

In `aztec-node/src/aztec-node/server.ts`:

- spartan-v5's
[#24283](#24283)
(`split server.ts into factory + focused modules`) rewrote the imports
and dropped `inspectBlockParameter` — its own uses moved into
`modules/node_world_state_queries.ts`, which imports it correctly.
- This train's
[#24207](#24207)
(`make node.getContract take an optional reference block`) still calls
`inspectBlockParameter(referenceBlock)` in `getContract`'s
reference-block-not-found error.

The auto-merge took spartan-v5's import block, leaving `getContract`
referencing an unimported symbol → `Cannot find name
'inspectBlockParameter'`.

## Fix

Re-add `inspectBlockParameter` to the existing `@aztec/stdlib/block`
import in `server.ts` (it is the only remaining consumer there, and the
symbol is still exported from that module). One-line change; the error
message is unchanged.

Since the train tip already contains spartan-v5's refactor, this PR's
own CI now builds the actual merged tree, so it verifies the fix
directly.

Refs
[#24223](#24223),
[#24207](#24207),
[#24283](#24283).
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.

2 participants