-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Feat] Introduces Record Versioning (V1), Sender Ciphertext, & Fixes Record Commitment #2793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…fixes tag to use commitment
Signed-off-by: Raymond Chu <[email protected]>
Signed-off-by: Raymond Chu <[email protected]>
Add V0 credits support to parameters
vicsn
left a comment
There was a problem hiding this 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()? |
There was a problem hiding this comment.
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?
Changelog
This PR includes the following major changes:
Record::versionwith Version 0 (old) and Version 1 (new)Record::is_hidingwhich istrueon Version 1 andfalseon Version 0Record::to_bitsserialization to support record versioningRecord::to_commitmentto use BHP commitments on Version 1sender_ciphertextwhich encrypts thesigneraddress under therecipient's addressSender Ciphertextsection belowOutput::decrypt_sender_ciphertextto decrypt thesender_ciphertextSender Ciphertext
This PR introduces a
sender_ciphertextwhich allows the recipient to decrypt the sender address using their account view key.The encryption scheme is as follows (where
vkis the recipient's account view key, andG^ris the record nonce):To perform decryption of the sender ciphertext, call
Output::decrypt_sender_ciphertextwith youraccount_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::InputIDnow includes for record inputs a{ "record_view_key": record_view_key }entryTransition::Outputnow includes for record outputs a{ "sender_ciphertext": sender_ciphertext }entryParameter changes
This PR also adds support for credits parameters and v0 credits parameters. The circuit changes will break the existing
credits.aleoVKs for functions that create or consume records.When a VM is loaded, it determines which credits verifying keys to use:
ConsensusVersion::V8ConsensusVersion::V8testfeatures is enabled.Once the VM passes the
ConsensusVersion::V8height, it will automatically swap thecredits.aleoVKs to the latest one.