Skip to content

refactor(aztec-nr): rename conversion fns to encode_/decode_ naming#22576

Merged
nchamo merged 4 commits intomerge-train/fairiesfrom
refactor/conversion-encode-decode-naming
Apr 16, 2026
Merged

refactor(aztec-nr): rename conversion fns to encode_/decode_ naming#22576
nchamo merged 4 commits intomerge-train/fairiesfrom
refactor/conversion-encode-decode-naming

Conversation

@nchamo
Copy link
Copy Markdown
Contributor

@nchamo nchamo commented Apr 15, 2026

Summary

  • Rename bytes_to_fields/bytes_from_fields/fields_to_bytes/fields_from_bytes to encode_/decode_ form and split into bytes_as_fields.nr and fields_as_bytes.nr.
  • New symbols are pub(crate); external contracts continue to use the old names via pub use aliases in conversion.nr.
  • Updates internal callers (aes128.nr, encoding.nr comments, compressed_string.nr TODOs).

Fixes F-364

@nchamo nchamo requested a review from nventuro as a code owner April 15, 2026 16:46
@nchamo nchamo self-assigned this Apr 15, 2026
Comment on lines -2 to -13
// - le_bytes_31_to_fields
// - fields_to_be_bytes_31
// - fields_to_le_bytes_31
// - byte_to_bits
// - get_random_bits
// - get_chunks_of_random_bits
// - pad_31_byte_fields_with_random_bits
// - le_bytes_to_padded_fields
// - be_bytes_to_padded_fields
//
// If you need any of these functions, please check the PR linked below:
// https://github.com/AztecProtocol/aztec-packages/pull/12581
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.

Removed all of these

@nchamo nchamo requested a review from benesjan April 15, 2026 19:05
///
/// Each 31-byte chunk is interpreted as a big-endian integer and stored in a `Field`. For input `[1, 10, 3, ..., 0]`
/// (31 bytes), the resulting `Field` is `1 * 256^30 + 10 * 256^29 + 3 * 256^28 + ... + 0`.
pub(crate) fn encode_bytes_as_fields<let N: u32>(bytes: [u8; N]) -> [Field; N / 31] {
Copy link
Copy Markdown
Contributor Author

@nchamo nchamo Apr 15, 2026

Choose a reason for hiding this comment

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

TODO per @nventuro :

  1. Make new functions public
  2. Add deprecation tag to old versions, suggesting to use the new ones

Comment thread noir-projects/aztec-nr/aztec/src/utils/conversion/bytes_as_fields.nr Outdated
@@ -1,20 +1,21 @@
// The following functions were removed as they were unused:
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.

Let's create an issue in the api renamings proj to rename this to encoding or whatever?

@nchamo nchamo removed the request for review from benesjan April 15, 2026 19:55
@nchamo nchamo enabled auto-merge (squash) April 16, 2026 11:27
@nchamo nchamo merged commit f1adea5 into merge-train/fairies Apr 16, 2026
21 of 25 checks passed
@nchamo nchamo deleted the refactor/conversion-encode-decode-naming branch April 16, 2026 11:27
@AztecBot
Copy link
Copy Markdown
Collaborator

✅ Successfully backported to backport-to-v4-next-staging #22580.

github-merge-queue Bot pushed a commit that referenced this pull request Apr 17, 2026
BEGIN_COMMIT_OVERRIDE
feat: check noir release has nargo binaries before releasing (#22551)
chore: cache chainInfo in embeddedwallet (#22592)
fix: wrap external getCapsule in transactionAsync (#22595)
fix(pxe): throw clear error for invalid comparator in pick_notes
(#22585)
refactor(aztec-nr): rename conversion fns to encode_/decode_ naming
(#22576)
fix: adding transactions to PXE stores (#22603)
feat: infrastructure for testing `[new_contract_artfiacts,
old_aztec_stack]` (#22593)
chore: fix unnecessary and inconsistent side-effect counter increments
(#22245)
feat(aztec-nr): new BoundedVec emit private log APIs (#22064)
END_COMMIT_OVERRIDE
Thunkar added a commit that referenced this pull request Apr 17, 2026
BEGIN_COMMIT_OVERRIDE
fix(pxe): cap event filter toBlock to last synced block (#22573)
fix(pxe): round tx expiration timestamp to reduce precision (#22577)
fix: eliminate anvil watcher warp race and false success logs (#22584)
refactor: aztec new and init creating 2 crates (#20681)
test: aztec new scaffold works (#20711)
feat(cli): warning if contract crate has tests (#20723)
feat(cli): auto-recompiling when aztec test is run (#20729)
feat: aztec new supporting multiple contract crates (#21007)
feat: asserts that aztec dep version matches cli (#21245)
chore: backport aztec CLI improvements to v4-next (#22587)
feat: check noir release has nargo binaries before releasing (#22551)
chore: cache chainInfo in embeddedwallet (#22592)
fix: wrap external getCapsule in transactionAsync (#22595)
fix(pxe): throw clear error for invalid comparator in pick_notes
(#22585)
refactor(aztec-nr): rename conversion fns to encode_/decode_ naming
(#22576)
feat: infrastructure for testing `[new_contract_artfiacts,
old_aztec_stack]` (#22593)
chore: fix unnecessary and inconsistent side-effect counter increments
(#22245)
fix: update FaceID wallet redirects and strip anchors in redirect
validation (#22505)
docs: add getting started on testnet guide (#22366)
docs: add getting started on testnet guide (backport #22366) (#22619)
feat(aztec-nr): new BoundedVec emit private log APIs (#22064)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants