|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <update_check.hpp>
Public Member Functions | |
| UpdateCheck (Poseidon2Interface &poseidon2, RangeCheckInterface &range_check, GreaterThanInterface >, HighLevelMerkleDBInterface &merkle_db, EventEmitterInterface< UpdateCheckEvent > &read_event_emitter, const GlobalVariables &globals) | |
| void | check_current_class_id (const AztecAddress &address, const ContractInstance &instance) override |
| Validate that a contract's current class ID is consistent with the delayed public mutable update state. | |
Public Member Functions inherited from bb::avm2::simulation::UpdateCheckInterface | |
| virtual | ~UpdateCheckInterface ()=default |
Private Attributes | |
| EventEmitterInterface< UpdateCheckEvent > & | update_check_events |
| Poseidon2Interface & | poseidon2 |
| RangeCheckInterface & | range_check |
| GreaterThanInterface & | gt |
| HighLevelMerkleDBInterface & | merkle_db |
| const GlobalVariables & | globals |
Definition at line 14 of file update_check.hpp.
|
inline |
Definition at line 16 of file update_check.hpp.
|
overridevirtual |
Validate that a contract's current class ID is consistent with the delayed public mutable update state.
Reads the delayed public mutable hash from the public data tree. If the hash is zero, the contract was never updated and current_class_id must equal original_class_id. Otherwise, reads the preimage (metadata, pre, post) in unconstrained mode, verifies it against the hash, decomposes the metadata to extract the timestamp of change, and selects the pre or post class ID based on whether the update has taken effect yet.
Emits a single UpdateCheckEvent on success with all fields populated. When the hash is zero, the preimage fields (metadata, pre_class_id, post_class_id) are all zero in the emitted event.
| address | The contract address to check. |
| instance | The contract instance containing original and current class IDs to validate. |
| std::runtime_error | If hash is zero and current_class_id does not match original_class_id. |
| std::runtime_error | If the stored hash does not match the reconstructed preimage hash (sanity check). |
| std::runtime_error | If the expected class ID (derived from update state and timestamp) does not match current_class_id. |
Implements bb::avm2::simulation::UpdateCheckInterface.
Definition at line 44 of file update_check.cpp.
|
private |
Definition at line 38 of file update_check.hpp.
|
private |
Definition at line 36 of file update_check.hpp.
|
private |
Definition at line 37 of file update_check.hpp.
|
private |
Definition at line 34 of file update_check.hpp.
|
private |
Definition at line 35 of file update_check.hpp.
|
private |
Definition at line 33 of file update_check.hpp.