Skip to content

fix: deriving serde on more public structs#17380

Merged
benesjan merged 1 commit intonextfrom
09-30-fix_deriving_serde_on_more_public_structs
Sep 30, 2025
Merged

fix: deriving serde on more public structs#17380
benesjan merged 1 commit intonextfrom
09-30-fix_deriving_serde_on_more_public_structs

Conversation

@benesjan
Copy link
Contributor

@benesjan benesjan commented Sep 30, 2025

In a PR down the stack I needed to slap #[derive(Deserialize)] on RetrievedNote because I returned it from a function. Nico proposed that we derive serde on more public structs because external won't be able to do so.

In this PR I went through the public structs in Aztec.nr and applied serde where I thought it could make sense to return from a contract function - in most of the cases it didn't make sense.

Copy link
Contributor Author

benesjan commented Sep 30, 2025

@@ -1,14 +0,0 @@
use crate::{hash::compute_secret_hash, oracle::random::random};

pub struct SecretAndHash {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was unused

}

#[test]
fn serialization_of_empty() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped this test as now, that serde is derived, it seems out of place.

@benesjan benesjan marked this pull request as ready for review September 30, 2025 07:01
@benesjan benesjan requested a review from LeilaWang as a code owner September 30, 2025 07:01
@benesjan benesjan requested a review from nventuro September 30, 2025 07:50

// TODO: Replace this with the derived version. Not done yet as this uncovered a bug in the AVM. See the discussion
// below for more details:
// https://aztecprotocol.slack.com/archives/C02M7VC7TN0/p1754463522334449
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CI passed so this is no longer an issue. What a nice surprise.

@benesjan benesjan requested a review from Thunkar September 30, 2025 07:51
Copy link
Contributor

@nventuro nventuro left a comment

Choose a reason for hiding this comment

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

Thanks! How did you find these and check there are no remnants?

@AztecBot AztecBot force-pushed the 09-26-refactor_dropping_getnotes_from_testwallet branch 2 times, most recently from c18f5d1 to b4fea5d Compare September 30, 2025 13:00
@benesjan benesjan marked this pull request as draft September 30, 2025 13:41
@benesjan benesjan force-pushed the 09-30-fix_deriving_serde_on_more_public_structs branch from aa83f67 to e226e02 Compare September 30, 2025 13:42
@benesjan benesjan force-pushed the 09-26-refactor_dropping_getnotes_from_testwallet branch from b4fea5d to a185f09 Compare September 30, 2025 13:42
@benesjan benesjan force-pushed the 09-30-fix_deriving_serde_on_more_public_structs branch from e226e02 to ceb46ab Compare September 30, 2025 13:45
@AztecBot AztecBot force-pushed the 09-26-refactor_dropping_getnotes_from_testwallet branch from 5467aab to 079f99d Compare September 30, 2025 14:08
@benesjan
Copy link
Contributor Author

Thanks! How did you find these and check there are no remnants?

@nventuro I just looked through the occurrences of "pub struct" string in noir-projects/aztec-nr and then guessed if it makes sense to ever return from a function.

I didn't apply it to a lot of those structs as I couldn't foresee those to ever be returned (e.g. state variables).

Base automatically changed from 09-26-refactor_dropping_getnotes_from_testwallet to next September 30, 2025 14:50
@benesjan benesjan force-pushed the 09-30-fix_deriving_serde_on_more_public_structs branch from ceb46ab to ee8ab33 Compare September 30, 2025 16:51
@benesjan benesjan marked this pull request as ready for review September 30, 2025 16:51
@benesjan benesjan enabled auto-merge September 30, 2025 16:51
In a PR down the stack I needed to slap `#[derive(Deserialize)]` on `RetrievedNote` because I returned it from a function. Nico proposed that we derive serde on more public structs because external won't be able to do so.

In this PR I went through the public structs in Aztec.nr and applied serde where I thought it could make sense to return from a contract function - in most of the cases it didn't make sense.
@AztecBot AztecBot force-pushed the 09-30-fix_deriving_serde_on_more_public_structs branch from ee8ab33 to 4369e5e Compare September 30, 2025 17:23
@benesjan benesjan added this pull request to the merge queue Sep 30, 2025
github-merge-queue bot pushed a commit that referenced this pull request Sep 30, 2025
In a PR down the stack I needed to slap `#[derive(Deserialize)]` on
`RetrievedNote` because I returned it from a function. Nico proposed
that we derive serde on more public structs because external won't be
able to do so.

In this PR I went through the public structs in Aztec.nr and applied
serde where I thought it could make sense to return from a contract
function - in most of the cases it didn't make sense.
auto-merge was automatically disabled September 30, 2025 18:19

Pull Request is not mergeable

Merged via the queue into next with commit 3d491c4 Sep 30, 2025
16 checks passed
@benesjan benesjan deleted the 09-30-fix_deriving_serde_on_more_public_structs branch September 30, 2025 19:07
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