Skip to content

Conversation

@raychu86
Copy link
Collaborator

@raychu86 raychu86 commented Jul 4, 2025

Changelog

This PR includes the following major changes:

  • Introduces Record::version with Version 0 (old) and Version 1 (new)
  • Introduces Record::is_hiding which is true on Version 1 and false on Version 0
  • Updates Record::to_bits serialization to support record versioning
  • Fixes Record::to_commitment to use BHP commitments on Version 1
  • Adds a sender_ciphertext which encrypts the signer address under the recipient's address
    • See Sender Ciphertext section below
  • Adds Output::decrypt_sender_ciphertext to decrypt the sender_ciphertext

Sender Ciphertext

This PR introduces a sender_ciphertext which allows the recipient to decrypt the sender address using their account view key.

The encryption scheme is as follows (where vk is the recipient's account view key, and G^r is the record nonce):

record_view_key := (G^vk) * r == (G^r) * vk
randomizer := Hash_PSD4( ENCRYPTION_DOMAIN || record_view_key || 1field )
sender_ciphertext := ToXCoordinate(signer_address) + randomizer

To perform decryption of the sender ciphertext, call Output::decrypt_sender_ciphertext with your account_view_key. If the given account view key does not belong to the given output record's owner, the function will return an error.

API Changes

The following APIs are impacted by this PR:

  • Request::InputID now includes for record inputs a { "record_view_key": record_view_key } entry
  • Transition::Output now includes for record outputs a { "sender_ciphertext": sender_ciphertext } entry

Parameter changes

This PR also adds support for credits parameters and v0 credits parameters. The circuit changes will break the existing credits.aleo VKs for functions that create or consume records.

When a VM is loaded, it determines which credits verifying keys to use:

  • V0 if the VM height is behind ConsensusVersion::V8
  • V1 if the VM height is on or after ConsensusVersion::V8
  • V0 if the environment is a test or the test features is enabled.

Once the VM passes the ConsensusVersion::V8 height, it will automatically swap the credits.aleo VKs to the latest one.

raychu86 and others added 30 commits June 12, 2025 14:59
@raychu86 raychu86 requested a review from vicsn July 4, 2025 18:12
@raychu86 raychu86 added the 4.0.0 label Jul 4, 2025
Base automatically changed from feat/new-inclusion to staging July 7, 2025 12:15
Copy link
Collaborator

@vicsn vicsn left a comment

Choose a reason for hiding this comment

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

Just two comments to improve my understanding, can be tackled in a future PR if needed

let consensus_version = N::CONSENSUS_VERSION(latest_block_height)?; // TODO (raychu86): Record Commitment - Select the proper consensus version.
// Initialize a new process based on the consensus version.
if (ConsensusVersion::V1..=ConsensusVersion::V7).contains(&consensus_version) {
Process::load_v0()?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll just note that it seems a bit odd that we make process loading during startup dependent on the current consensus version. Are we also updating whenever we reach that consensus version as we're progressing at tip?

@vicsn vicsn merged commit d9ba009 into staging Jul 7, 2025
2 checks passed
@vicsn vicsn deleted the feat/record-v1 branch July 7, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants