Skip to content

feat!: make node.getContract take a reference block - #24205

Closed
nventuro wants to merge 2 commits into
merge-train/fairies-v5from
nv/get-contract-reference-block
Closed

feat!: make node.getContract take a reference block#24205
nventuro wants to merge 2 commits into
merge-train/fairies-v5from
nv/get-contract-reference-block

Conversation

@nventuro

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.

@nventuro
nventuro requested a review from spalladino June 19, 2026 19:57
@nventuro
nventuro requested a review from a team as a code owner June 19, 2026 19:57
* @param address - Address of the deployed contract.
*/
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
getContract(referenceBlock: BlockParameter, address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;

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.

Can you flip the arguments and make referenceBlock optional, so the change is backwards compatible and we don't accidentally break stuff if we can avoid it?

nventuro added a commit that referenced this pull request Jun 22, 2026
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

---------

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
@nventuro

Copy link
Copy Markdown
Contributor Author

Superceded by #24207.

@nventuro nventuro closed this Jun 22, 2026
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