47 FF delayed_public_mutable_slot =
58 FF update_preimage_pre_class_id = 0;
59 FF update_preimage_post_class_id = 0;
63 if (update_hash == 0) {
66 if (
instance.original_contract_class_id !=
instance.current_contract_class_id) {
67 throw std::runtime_error(
"Current class id does not match expected class id");
78 std::vector<FF> update_preimage(3);
80 for (
size_t i = 0; i < update_preimage.size(); ++i) {
82 delayed_public_mutable_slot + i);
83 update_preimage[i] = unconstrained_read(unconstrained_merkle_db, leaf_slot);
89 if (update_hash != reconstructed_hash) {
90 throw std::runtime_error(
"Stored hash does not match preimage hash");
93 update_preimage_metadata =
static_cast<uint256_t>(update_preimage[0]);
94 update_preimage_pre_class_id = update_preimage[1];
95 update_preimage_post_class_id = update_preimage[2];
101 uint64_t timestamp_of_change =
102 static_cast<uint64_t
>(
static_cast<uint32_t
>(update_preimage_metadata & 0xffffffff));
112 update_preimage_pre_class_id == 0 ?
instance.original_contract_class_id : update_preimage_pre_class_id;
114 update_preimage_post_class_id == 0 ?
instance.original_contract_class_id : update_preimage_post_class_id;
116 FF expected_current_class_id =
gt.gt(timestamp_of_change, current_timestamp) ? pre_class : post_class;
118 if (expected_current_class_id !=
instance.current_contract_class_id) {
119 throw std::runtime_error(
121 " does not match expected class id: " +
field_to_string(expected_current_class_id));
127 .current_class_id =
instance.current_contract_class_id,
128 .original_class_id =
instance.original_contract_class_id,
130 .current_timestamp = current_timestamp,
131 .update_hash = update_hash,
132 .update_preimage_metadata = update_preimage_metadata,
133 .update_preimage_pre_class_id = update_preimage_pre_class_id,
134 .update_preimage_post_class_id = update_preimage_post_class_id,
135 .delayed_public_mutable_slot = delayed_public_mutable_slot,