|
1 | 1 | namespace bytecode(256);
|
2 | 2 |
|
3 |
| - pol commit packed; |
| 3 | + // Raw bytes |
| 4 | + pol commit bytes; |
| 5 | + pol commit bytes_pc; |
| 6 | + |
| 7 | + // =============== BYTECODE DECOMPOSITION ================================================= |
| 8 | + // Decomposed into 35 byte chunks to parse into instructions |
| 9 | + pol commit decomposed; |
| 10 | + |
| 11 | + // =============== BYTECODE ENCODING ================================================= |
| 12 | + // Bytes packed into 31 byte chunks |
| 13 | + pol commit as_fields; |
| 14 | + |
| 15 | + // =============== BYTECODE HASHING + ADDRESS DERIVATION ================================================= |
4 | 16 | pol commit length_remaining;
|
| 17 | + |
| 18 | + // Bytecode public commitment hash |
5 | 19 | pol commit running_hash;
|
6 | 20 |
|
| 21 | + // When this is 1, it represents when reached the end of a contract bytecode |
7 | 22 | pol commit end_latch;
|
| 23 | + end_latch * (1 - end_latch) = 0; |
| 24 | + |
| 25 | + /* Derive Class Id */ |
| 26 | + pol CONTRACT_LEAF = 16; |
| 27 | + pol commit arifact_hash; |
| 28 | + pol commit private_fn_root; |
| 29 | + // class_id = H(CONTRACT_LEAF, artifact_hash, private_fn_root, running_hash) |
| 30 | + pol commit class_id; |
8 | 31 |
|
9 |
| - // TODO: Come back to this; |
10 |
| - // pol commit class_id; |
11 |
| - // pol commit contract_address; |
| 32 | + /* Derive Contract Addr*/ |
| 33 | + pol CONTRACT_ADDRESS_V1 = 15; |
| 34 | + pol PARTIAL_ADDRESS = 27; |
| 35 | + // pol SALTED_INIT_HASH = H(PARTIAL_ADDR, salt, init_hash, deployer_addr); |
| 36 | + // pol PARTIAL_ADDR = H(PARTIAL_ADDR, class_id, SALTED_INIT_HASH); |
| 37 | + pol commit salt; |
| 38 | + pol commit initialization_hash; |
| 39 | + pol commit deployer_addr; |
| 40 | + // These are points in grumpkin |
| 41 | + // Nullifier Key |
| 42 | + pol commit nullifier_key_x; |
| 43 | + pol commit nullifier_key_y; |
| 44 | + // Incoming viewing public key |
| 45 | + pol commit incoming_viewing_key_x; |
| 46 | + pol commit incoming_viewing_key_y; |
| 47 | + // Outgoing viewing public key |
| 48 | + pol commit outgoing_viewing_key_x; |
| 49 | + pol commit outgoing_viewing_key_y; |
| 50 | + // Tagging viewing public key |
| 51 | + pol commit tagging_key_x; |
| 52 | + pol commit tagging_key_y; |
12 | 53 |
|
| 54 | + // When we flat hash these points, we need to include 0 to indicate non-inf |
| 55 | + // public_key_hash = H(nullifier_key_x,nullifier_key_y,0, incoming_viewing_key_x, incoming_viewing_key_y, 0, |
| 56 | + // outgoing_viewing_key_x, outgoing_viewing_key_y, 0, tagging_key_x, tagging_key_y,0) |
| 57 | + pol commit public_key_hash; |
| 58 | + // h = H(CONTRACT_ADDRESS_V1, public_key_hash, partial_address) |
| 59 | + // contract_address = h * G + incoming_viewing_key |
| 60 | + pol commit contract_address; |
13 | 61 |
|
0 commit comments