diff --git a/crates/sui-core/src/authority/authority_store.rs b/crates/sui-core/src/authority/authority_store.rs index 3dcefc3f5182e3..c18f63fb63364d 100644 --- a/crates/sui-core/src/authority/authority_store.rs +++ b/crates/sui-core/src/authority/authority_store.rs @@ -1316,7 +1316,6 @@ impl AuthorityStore { objects: &[ObjectRef], is_force_reset: bool, ) -> SuiResult { - trace!(?objects, "initialize_locks"); AuthorityStore::initialize_live_object_markers( &self.perpetual_tables.live_owned_object_markers, write_batch, diff --git a/crates/sui-core/src/execution_cache/writeback_cache.rs b/crates/sui-core/src/execution_cache/writeback_cache.rs index dfaf897047928d..a9b4ca7dd8319e 100644 --- a/crates/sui-core/src/execution_cache/writeback_cache.rs +++ b/crates/sui-core/src/execution_cache/writeback_cache.rs @@ -456,7 +456,7 @@ impl WritebackCache { version: SequenceNumber, object: ObjectEntry, ) { - debug!("inserting object entry {:?}: {:?}", object_id, version); + debug!("inserting object entry {:?}", object); fail_point_async!("write_object_entry"); self.metrics.record_cache_write("object"); self.dirty @@ -575,22 +575,28 @@ impl WritebackCache { if cfg!(debug_assertions) { if let Some(entry) = &entry { // check that cache is coherent - let highest = self + let highest: Option = self .dirty .objects .get(object_id) - .and_then(|entry| entry.get_highest().map(|(version, _)| *version)) + .and_then(|entry| entry.get_highest().map(|(_, o)| o.clone())) .or_else(|| { - let object = self.store.get_object(object_id).unwrap(); - object.map(|o| o.version()) + let obj: Option = self + .store + .get_latest_object_or_tombstone(*object_id) + .unwrap() + .map(|(_, o)| o.into()); + obj }); assert_eq!( highest, match &*entry.lock() { - LatestObjectCacheEntry::Object(version, _) => Some(*version), + LatestObjectCacheEntry::Object(version, entry) => Some(entry.clone()), LatestObjectCacheEntry::NonExistent => None, - } + }, + "object_by_id cache is incoherent for {:?}", + object_id ); } } diff --git a/crates/sui-types/src/storage/mod.rs b/crates/sui-types/src/storage/mod.rs index 0e565b3b651d8c..134c98434ded68 100644 --- a/crates/sui-types/src/storage/mod.rs +++ b/crates/sui-types/src/storage/mod.rs @@ -470,6 +470,15 @@ pub enum ObjectOrTombstone { Tombstone(ObjectRef), } +impl ObjectOrTombstone { + pub fn as_objref(&self) -> ObjectRef { + match self { + ObjectOrTombstone::Object(obj) => obj.compute_object_reference(), + ObjectOrTombstone::Tombstone(obref) => *obref, + } + } +} + impl From for ObjectOrTombstone { fn from(object: Object) -> Self { ObjectOrTombstone::Object(object)