-
Notifications
You must be signed in to change notification settings - Fork 240
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
feat: derive address and class id in avm #8897
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,61 @@ | ||
namespace bytecode(256); | ||
|
||
pol commit packed; | ||
// Raw bytes | ||
pol commit bytes; | ||
pol commit bytes_pc; | ||
|
||
// =============== BYTECODE DECOMPOSITION ================================================= | ||
// Decomposed into 35 byte chunks to parse into instructions | ||
pol commit decomposed; | ||
|
||
// =============== BYTECODE ENCODING ================================================= | ||
// Bytes packed into 31 byte chunks | ||
pol commit as_fields; | ||
|
||
// =============== BYTECODE HASHING + ADDRESS DERIVATION ================================================= | ||
pol commit length_remaining; | ||
|
||
// Bytecode public commitment hash | ||
pol commit running_hash; | ||
|
||
// When this is 1, it represents when reached the end of a contract bytecode | ||
pol commit end_latch; | ||
end_latch * (1 - end_latch) = 0; | ||
|
||
/* Derive Class Id */ | ||
pol CONTRACT_LEAF = 16; | ||
pol commit arifact_hash; | ||
pol commit private_fn_root; | ||
// class_id = H(CONTRACT_LEAF, artifact_hash, private_fn_root, running_hash) | ||
pol commit class_id; | ||
|
||
// TODO: Come back to this; | ||
// pol commit class_id; | ||
// pol commit contract_address; | ||
/* Derive Contract Addr*/ | ||
pol CONTRACT_ADDRESS_V1 = 15; | ||
pol PARTIAL_ADDRESS = 27; | ||
// pol SALTED_INIT_HASH = H(PARTIAL_ADDR, salt, init_hash, deployer_addr); | ||
// pol PARTIAL_ADDR = H(PARTIAL_ADDR, class_id, SALTED_INIT_HASH); | ||
pol commit salt; | ||
pol commit initialization_hash; | ||
pol commit deployer_addr; | ||
// These are points in grumpkin | ||
// Nullifier Key | ||
pol commit nullifier_key_x; | ||
pol commit nullifier_key_y; | ||
// Incoming viewing public key | ||
pol commit incoming_viewing_key_x; | ||
pol commit incoming_viewing_key_y; | ||
// Outgoing viewing public key | ||
pol commit outgoing_viewing_key_x; | ||
pol commit outgoing_viewing_key_y; | ||
// Tagging viewing public key | ||
pol commit tagging_key_x; | ||
pol commit tagging_key_y; | ||
|
||
// When we flat hash these points, we need to include 0 to indicate non-inf | ||
// public_key_hash = H(nullifier_key_x,nullifier_key_y,0, incoming_viewing_key_x, incoming_viewing_key_y, 0, | ||
// outgoing_viewing_key_x, outgoing_viewing_key_y, 0, tagging_key_x, tagging_key_y,0) | ||
pol commit public_key_hash; | ||
// h = H(CONTRACT_ADDRESS_V1, public_key_hash, partial_address) | ||
// contract_address = h * G + incoming_viewing_key | ||
pol commit contract_address; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is just a placeholder for the future