Skip to content

fix(pxe): backward & forward compatible deserialization of validation requests#20957

Closed
nchamo wants to merge 7 commits intomerge-train/fairiesfrom
fix/backward-compat-pxe-deserialization
Closed

fix(pxe): backward & forward compatible deserialization of validation requests#20957
nchamo wants to merge 7 commits intomerge-train/fairiesfrom
fix/backward-compat-pxe-deserialization

Conversation

@nchamo
Copy link
Contributor

@nchamo nchamo commented Feb 27, 2026

Summary

In #20840, we introduced a change to reflect the actual max length used for messages and notes, we were not calculating it correctly beforehand. The main issue is that aztec-nr used those notes/events max lengths as the max size for BoundedVec when communicating with PXE. And, on PXE's side, we also used that value to deserialize the BoundedVec.

But when we updated those values, old contracts were no longer compatible with the new version of PXE and new contracts were no longer compatible with the old version of PXE.

We want to prevent this from happening again, so we are now passing these values from aztec-nr to PXE. In this PR, we are using capsules and we are setting the defaults to the values before #20840 was introduced. This makes this approach backwards and forwards compatible

We are taking a different approach in #21176, that would only help is in the to prevent this from happening again, but it would be a breaking change

Fixes #14617
Fixes F-375

@nchamo nchamo self-assigned this Feb 27, 2026
@nchamo nchamo added the ci-draft Run CI on draft PRs. label Feb 27, 2026
import { MAX_NOTE_PACKED_LEN } from './note_validation_request.js';

const MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION = MAX_NOTE_PACKED_LEN;
const MAX_LOG_CONTENT_LEN = Math.max(MAX_PUBLIC_LOG_LEN_FOR_NOTE_COMPLETION, PRIVATE_LOG_CIPHERTEXT_LEN);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it didn't make sense to have this. MAX_NOTE_PACKED_LEN is calculated in aztec-nr from PRIVATE_LOG_CIPHERTEXT_LEN, and it should always be lower for it. But please correct me if I'm wrong

@nchamo nchamo requested a review from nventuro February 27, 2026 19:24
@benesjan benesjan self-requested a review March 2, 2026 05:08
Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

Regarding the approaches you described in the PR description I am not sure approach 2 is preferable because it has a lot of assumptions.

Why not go with approach 1? Is it because we no longer want to break oracles? (which approach 1 would probably break as keeping older and newer version of the oracle seem too messy)

@nchamo nchamo requested review from benesjan and removed request for nventuro March 2, 2026 21:02
Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

I think this approach is nice so would go ahead with it.

Pretty cool how flexible are capsules.

Feels like we could use this approach in future oracle backwards compatibility issues as well.

Please request me for a review again once you polish it 😊

@nchamo nchamo marked this pull request as ready for review March 4, 2026 14:21
@nchamo nchamo requested a review from nventuro as a code owner March 4, 2026 14:21
@nchamo nchamo requested a review from benesjan March 4, 2026 14:21
@nchamo nchamo changed the title fix(pxe): backward-compatible deserialization of validation requests fix(pxe): backward & forward compatible deserialization of validation requests Mar 4, 2026
Comment on lines +164 to +167
oracle::capsules::store(
contract_address,
EVENT_BOUNDED_VEC_CAPACITY_SLOT,
[MAX_EVENT_SERIALIZED_LEN as Field],
Copy link
Contributor

Choose a reason for hiding this comment

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

waaaaat? Doesn't the PR description say that we can just pass these values as params to the oracle? that seems much saner.

@nchamo nchamo marked this pull request as draft March 5, 2026 16:46
@nchamo
Copy link
Contributor Author

nchamo commented Mar 7, 2026

Closing in favor of #21176

@nchamo nchamo closed this Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v4 ci-draft Run CI on draft PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants