Skip to content

Commit 614aec9

Browse files
committed
Update domain separator values.
1 parent a4fc873 commit 614aec9

124 files changed

Lines changed: 6980 additions & 6790 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

barretenberg/cpp/pil/vm2/bytecode/update_check.pil

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ namespace update_check;
5757
// TODO: Remove this as a column when we can lookup with constants
5858
pol commit updated_class_ids_slot;
5959
sel * (constants.UPDATED_CLASS_IDS_SLOT - updated_class_ids_slot) = 0;
60+
pol commit dom_sep_public_storage_map_slot;
61+
sel * (constants.DOM_SEP__PUBLIC_STORAGE_MAP_SLOT - dom_sep_public_storage_map_slot) = 0;
6062

6163
pol commit delayed_public_mutable_slot;
6264

6365
#[DELAYED_PUBLIC_MUTABLE_SLOT_POSEIDON2]
64-
sel { sel /* =1 */, updated_class_ids_slot, address, precomputed.zero, delayed_public_mutable_slot }
66+
sel { sel /* =1 */, dom_sep_public_storage_map_slot, updated_class_ids_slot, address, delayed_public_mutable_slot }
6567
in poseidon2_hash.end { poseidon2_hash.start, poseidon2_hash.input_0, poseidon2_hash.input_1, poseidon2_hash.input_2, poseidon2_hash.output };
6668

6769
pol commit delayed_public_mutable_hash_slot;

barretenberg/cpp/pil/vm2/constants_gen.pil

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,16 @@ namespace constants;
165165
pol UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE = 144;
166166
pol GRUMPKIN_ONE_X = 1;
167167
pol GRUMPKIN_ONE_Y = 17631683881184975370165255887551781615748388533673675138860;
168-
pol DOM_SEP__NOTE_HASH_NONCE = 2;
169-
pol DOM_SEP__UNIQUE_NOTE_HASH = 3;
170-
pol DOM_SEP__SILOED_NOTE_HASH = 4;
171-
pol DOM_SEP__OUTER_NULLIFIER = 7;
172-
pol DOM_SEP__PUBLIC_LEAF_INDEX = 23;
173-
pol DOM_SEP__PUBLIC_BYTECODE = 60;
174-
pol DOM_SEP__CONTRACT_CLASS_ID = 16;
175-
pol DOM_SEP__PUBLIC_KEYS_HASH = 52;
176-
pol DOM_SEP__PARTIAL_ADDRESS = 27;
177-
pol DOM_SEP__CONTRACT_ADDRESS_V1 = 15;
178-
pol DOM_SEP__PUBLIC_CALLDATA = 43;
168+
pol DOM_SEP__NOTE_HASH_NONCE = 4040695053;
169+
pol DOM_SEP__UNIQUE_NOTE_HASH = 1615905817;
170+
pol DOM_SEP__SILOED_NOTE_HASH = 3552985968;
171+
pol DOM_SEP__OUTER_NULLIFIER = 3537029706;
172+
pol DOM_SEP__PUBLIC_LEAF_SLOT = 2853865602;
173+
pol DOM_SEP__PUBLIC_STORAGE_MAP_SLOT = 1106049611;
174+
pol DOM_SEP__PUBLIC_BYTECODE = 4245021897;
175+
pol DOM_SEP__CONTRACT_CLASS_ID = 1134959961;
176+
pol DOM_SEP__PUBLIC_KEYS_HASH = 349301051;
177+
pol DOM_SEP__PARTIAL_ADDRESS = 1453969891;
178+
pol DOM_SEP__CONTRACT_ADDRESS_V1 = 2091531360;
179+
pol DOM_SEP__PUBLIC_CALLDATA = 388853507;
179180

barretenberg/cpp/pil/vm2/trees/public_data_check.pil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace public_data_check;
149149

150150
// TODO: We need this temporarily while we do not allow for aliases in the lookup tuple
151151
pol commit siloing_separator;
152-
sel * (constants.DOM_SEP__PUBLIC_LEAF_INDEX - siloing_separator) = 0;
152+
sel * (constants.DOM_SEP__PUBLIC_LEAF_SLOT - siloing_separator) = 0;
153153

154154
#[SILO_POSEIDON2]
155155
sel { sel, siloing_separator, address, slot, leaf_slot }

barretenberg/cpp/pil/vm2/trees/written_public_data_slots_tree_check.pil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace written_public_data_slots_tree_check;
8181

8282
// TODO: We need this temporarily while we do not allow for aliases in the lookup tuple
8383
pol commit siloing_separator;
84-
sel * (constants.DOM_SEP__PUBLIC_LEAF_INDEX - siloing_separator) = 0;
84+
sel * (constants.DOM_SEP__PUBLIC_LEAF_SLOT - siloing_separator) = 0;
8585

8686
#[SILO_POSEIDON2]
8787
sel { sel, siloing_separator, address, slot, leaf_slot }

barretenberg/cpp/pil/vm2/tx.pil

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,13 @@ namespace tx;
652652
is_collect_fee * (constants.FEE_JUICE_ADDRESS - fee_juice_contract_address) = 0;
653653
pol commit fee_juice_balances_slot_constant;
654654
is_collect_fee * (constants.FEE_JUICE_BALANCES_SLOT - fee_juice_balances_slot_constant) = 0;
655+
pol commit dom_sep_public_storage_map_slot;
656+
is_collect_fee * (constants.DOM_SEP__PUBLIC_STORAGE_MAP_SLOT - dom_sep_public_storage_map_slot) = 0;
655657

656658
pol commit fee_juice_balance_slot;
657659

658660
#[BALANCE_SLOT_POSEIDON2]
659-
is_collect_fee { is_collect_fee, fee_juice_balances_slot_constant, fee_payer, precomputed.zero, fee_juice_balance_slot }
661+
is_collect_fee { is_collect_fee, dom_sep_public_storage_map_slot, fee_juice_balances_slot_constant, fee_payer, fee_juice_balance_slot }
660662
in poseidon2_hash.end { poseidon2_hash.start, poseidon2_hash.input_0, poseidon2_hash.input_1, poseidon2_hash.input_2, poseidon2_hash.output };
661663

662664
pol commit fee_payer_balance;

barretenberg/cpp/src/barretenberg/avm_fuzzer/common/interfaces/dbs.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void FuzzerWorldStateManager::initialize_world_state()
196196
{ simulation::MerkleTreeId::NULLIFIER_TREE, 128 },
197197
{ simulation::MerkleTreeId::PUBLIC_DATA_TREE, 128 },
198198
};
199-
uint32_t initial_header_generator_point = 28; // GeneratorIndex.BLOCK_HASH
199+
uint32_t initial_header_generator_point = 2064783670; // GeneratorIndex.BLOCK_HEADER_HASH
200200
ws = std::make_unique<world_state::WorldState>(
201201
/*thread_pool_size=*/4, DATA_DIR, MAP_SIZE_KB, tree_heights, tree_prefill, initial_header_generator_point);
202202

@@ -236,8 +236,9 @@ void FuzzerWorldStateManager::write_fee_payer_balance(const AztecAddress& fee_pa
236236
if (fee_payer == 0) {
237237
return;
238238
}
239-
FF fee_juice_balance_slot = Poseidon2::hash({ FEE_JUICE_BALANCES_SLOT, fee_payer });
240-
FF leaf_slot = Poseidon2::hash({ DOM_SEP__PUBLIC_LEAF_INDEX, FF(FEE_JUICE_ADDRESS), fee_juice_balance_slot });
239+
FF fee_juice_balance_slot =
240+
Poseidon2::hash({ DOM_SEP__PUBLIC_STORAGE_MAP_SLOT, FEE_JUICE_BALANCES_SLOT, fee_payer });
241+
FF leaf_slot = Poseidon2::hash({ DOM_SEP__PUBLIC_LEAF_SLOT, FF(FEE_JUICE_ADDRESS), fee_juice_balance_slot });
241242

242243
// Write to public data tree using current fork
243244
auto fork_id = fork_ids.top();

barretenberg/cpp/src/barretenberg/avm_fuzzer/mutations/bytecode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ void mutate_bytecode(std::vector<ContractClassWithCommitment>& contract_classes,
9595
contract_classes.push_back(new_class);
9696

9797
// Compute public data tree writes for UpdateCheck to pass
98-
FF delayed_public_mutable_slot = Poseidon2::hash({ FF(UPDATED_CLASS_IDS_SLOT), address });
98+
FF delayed_public_mutable_slot =
99+
Poseidon2::hash({ FF(DOM_SEP__PUBLIC_STORAGE_MAP_SLOT), FF(UPDATED_CLASS_IDS_SLOT), address });
99100

100101
// Build preimage
101102
// todo(ilyas): make this somewhat random but also take into account the mutation on global variables.timestamp
@@ -107,7 +108,7 @@ void mutate_bytecode(std::vector<ContractClassWithCommitment>& contract_classes,
107108
for (size_t i = 0; i < 4; i++) {
108109
FF storage_slot = delayed_public_mutable_slot + i;
109110
FF leaf_slot = Poseidon2::hash(
110-
{ FF(DOM_SEP__PUBLIC_LEAF_INDEX), FF(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), storage_slot });
111+
{ FF(DOM_SEP__PUBLIC_LEAF_SLOT), FF(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS), storage_slot });
111112
public_data_writes.push_back(bb::crypto::merkle_tree::PublicDataLeafValue{ leaf_slot, values[i] });
112113
}
113114
}

barretenberg/cpp/src/barretenberg/vm2/common/aztec_constants.hpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#define MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX 64
1818
#define MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX 63
1919
#define MAX_L2_TO_L1_MSGS_PER_TX 8
20-
#define GENESIS_BLOCK_HEADER_HASH "0x0dc66232e4edff2923217f4fdf80ecc23ed4bd047e743df85a6827878bf6c4d6"
21-
#define GENESIS_ARCHIVE_ROOT "0x1f8c805403d88ee809d3cb3e52eeba0a104f69968cdb844a9cbdf1e9e00b3a95"
20+
#define GENESIS_BLOCK_HEADER_HASH "0x20859c34fd7cd64578ba0779e7475e56900de9b95f1b634fbe2d7b266d8d2840"
21+
#define GENESIS_ARCHIVE_ROOT "0x2b7cc335b4798b4d9b5e88cd6b55b1ce54b1225970ad2adff7820413a3c4ca3c"
2222
#define MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS 3000
2323
#define MAX_PROTOCOL_CONTRACTS 11
2424
#define CANONICAL_AUTH_REGISTRY_ADDRESS 1
@@ -254,14 +254,16 @@
254254
#define UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN 3
255255
#define UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE 144
256256
#define DEFAULT_MAX_DEBUG_LOG_MEMORY_READS 125000
257-
#define DOM_SEP__NOTE_HASH_NONCE 2
258-
#define DOM_SEP__UNIQUE_NOTE_HASH 3
259-
#define DOM_SEP__SILOED_NOTE_HASH 4
260-
#define DOM_SEP__OUTER_NULLIFIER 7
261-
#define DOM_SEP__PUBLIC_LEAF_INDEX 23
262-
#define DOM_SEP__PUBLIC_BYTECODE 60
263-
#define DOM_SEP__CONTRACT_CLASS_ID 16
264-
#define DOM_SEP__PUBLIC_KEYS_HASH 52
265-
#define DOM_SEP__PARTIAL_ADDRESS 27
266-
#define DOM_SEP__CONTRACT_ADDRESS_V1 15
267-
#define DOM_SEP__PUBLIC_CALLDATA 43
257+
#define DOM_SEP__NOTE_HASH_NONCE 4040695053UL
258+
#define DOM_SEP__UNIQUE_NOTE_HASH 1615905817UL
259+
#define DOM_SEP__SILOED_NOTE_HASH 3552985968UL
260+
#define DOM_SEP__OUTER_NULLIFIER 3537029706UL
261+
#define DOM_SEP__PUBLIC_LEAF_SLOT 2853865602UL
262+
#define DOM_SEP__PUBLIC_STORAGE_MAP_SLOT 1106049611UL
263+
#define DOM_SEP__PUBLIC_BYTECODE 4245021897UL
264+
#define DOM_SEP__CONTRACT_CLASS_ID 1134959961UL
265+
#define DOM_SEP__PUBLIC_KEYS_HASH 349301051UL
266+
#define DOM_SEP__PARTIAL_ADDRESS 1453969891UL
267+
#define DOM_SEP__CONTRACT_ADDRESS_V1 2091531360UL
268+
#define DOM_SEP__BLOCK_HEADER_HASH 2064783670UL
269+
#define DOM_SEP__PUBLIC_CALLDATA 388853507UL

barretenberg/cpp/src/barretenberg/vm2/constraining/relations/bc_hashing.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ TEST_F(BytecodeHashingConstrainingTest, SingleBytecodeHashOneRow)
183183
TEST_F(BytecodeHashingConstrainingTestTraceHelper, SingleBytecodeHash100Fields)
184184
{
185185
// The hardcoded value is taken from noir-projects/aztec-nr/aztec/src/hash.nr:
186-
FF hash = FF("0x16d621c3387156ef53754679e7b2c9be8f0bceeb44aa59a74991df3b0b42a0bf");
186+
FF hash = FF("0x2c5e4c67ad5e1e4d840a6c4db4cee765fe09fbb6dfbb89ab649c295bb01f206e");
187187

188188
std::vector<FF> bytecode_fields = {};
189189
for (uint32_t i = 1; i < 100; i++) {

barretenberg/cpp/src/barretenberg/vm2/constraining/relations/calldata_hashing.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ TEST_F(CalldataHashingConstrainingTestTraceHelper, EmptyCalldataHash)
255255
TEST_F(CalldataHashingConstrainingTestTraceHelper, SingleCalldataHash100Fields)
256256
{
257257
// The hardcoded value is taken from noir-projects/aztec-nr/aztec/src/hash.nr:
258-
FF hash = FF("0x191383c9f8964afd3ea8879a03b7dda65d6724773966d18dcf80e452736fc1f3");
258+
FF hash = FF("0x0a11986d25a1f1639715047e125db86b0c684b44d736c0aa64c236d3e05c30b0");
259259

260260
std::vector<FF> calldata_fields = {};
261261
calldata_fields.reserve(100);

0 commit comments

Comments
 (0)