@@ -18,11 +18,14 @@ BytecodeId TxBytecodeManager::get_bytecode(const AztecAddress& address)
1818 // This handles nullifier checks, address derivation, and update validation
1919 auto maybe_instance = contract_instance_manager.get_contract_instance (address);
2020
21+ auto tree_states = merkle_db.get_tree_state ();
2122 if (!maybe_instance.has_value ()) {
2223 // Contract instance not found - emit error event and throw
2324 retrieval_events.emit ({
2425 .bytecode_id = FF (0 ), // Use default ID for error case
2526 .address = address,
27+ .nullifier_root = tree_states.nullifierTree .tree .root ,
28+ .public_data_tree_root = tree_states.publicDataTree .tree .root ,
2629 .error = true ,
2730 });
2831 vinfo (" Contract " , field_to_string (address), " is not deployed!" );
@@ -45,7 +48,6 @@ BytecodeId TxBytecodeManager::get_bytecode(const AztecAddress& address)
4548 // Check if we've already processed this bytecode. If so, don't do hashing and decomposition again!
4649 if (bytecodes.contains (bytecode_id)) {
4750 // Already processed this bytecode - just emit retrieval event and return
48- auto tree_states = merkle_db.get_tree_state ();
4951 retrieval_events.emit ({
5052 .bytecode_id = bytecode_id,
5153 .address = address,
@@ -69,8 +71,6 @@ BytecodeId TxBytecodeManager::get_bytecode(const AztecAddress& address)
6971 // We now save the bytecode so that we don't repeat this process.
7072 bytecodes.emplace (bytecode_id, std::move (shared_bytecode));
7173
72- auto tree_states = merkle_db.get_tree_state ();
73-
7474 retrieval_events.emit ({
7575 .bytecode_id = bytecode_id,
7676 .address = address,
0 commit comments