47 FF delayed_public_mutable_slot =
49 FF delayed_public_mutable_hash_slot = delayed_public_mutable_slot + UPDATES_DELAYED_PUBLIC_MUTABLE_VALUES_LEN;
55 merkle_db.
storage_read(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS, delayed_public_mutable_hash_slot);
58 FF update_preimage_pre_class_id = 0;
59 FF update_preimage_post_class_id = 0;
63 if (update_hash == 0) {
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];
98 uint128_t update_metadata_hi =
static_cast<uint128_t>(update_preimage_metadata >> TIMESTAMP_OF_CHANGE_BIT_SIZE);
101 uint64_t timestamp_of_change =
102 static_cast<uint64_t
>(
static_cast<uint32_t
>(update_preimage_metadata & 0xffffffff));
106 UPDATES_DELAYED_PUBLIC_MUTABLE_METADATA_BIT_SIZE - TIMESTAMP_OF_CHANGE_BIT_SIZE);
107 range_check.assert_range(timestamp_of_change, TIMESTAMP_OF_CHANGE_BIT_SIZE);
116 FF expected_current_class_id =
gt.gt(timestamp_of_change, current_timestamp) ? pre_class : post_class;
119 throw std::runtime_error(
121 " does not match expected class id: " +
field_to_string(expected_current_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,