Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ exclude = [
"external-crates/move/crates/move-ir-to-bytecode-syntax",
"external-crates/move/crates/move-ir-types",
"external-crates/move/crates/move-model",
"external-crates/move/crates/move-model-2",
"external-crates/move/crates/move-model-2",
"external-crates/move/crates/move-package",
"external-crates/move/crates/move-package-alt",
"external-crates/move/crates/move-package-alt",
"external-crates/move/crates/move-proc-macros",
"external-crates/move/crates/move-regex-borrow-graph",
"external-crates/move/crates/move-stackless-bytecode",
Expand All @@ -58,6 +58,10 @@ exclude = [
"external-crates/move/crates/move-vm-transactional-tests",
"external-crates/move/crates/serializer-tests",
"external-crates/move/crates/test-generation",
"external-crates/move/move-execution/replay_cut/crates/move-bytecode-verifier",
"external-crates/move/move-execution/replay_cut/crates/move-stdlib-natives",
"external-crates/move/move-execution/replay_cut/crates/move-vm-runtime",
"external-crates/move/move-execution/replay_cut/crates/move-vm-types",
"external-crates/move/move-execution/v0/crates/move-bytecode-verifier",
"external-crates/move/move-execution/v0/crates/move-stdlib-natives",
"external-crates/move/move-execution/v0/crates/move-vm-runtime",
Expand Down Expand Up @@ -212,6 +216,9 @@ members = [
"sui-execution/latest/sui-adapter",
"sui-execution/latest/sui-move-natives",
"sui-execution/latest/sui-verifier",
"sui-execution/replay_cut/sui-adapter",
"sui-execution/replay_cut/sui-move-natives",
"sui-execution/replay_cut/sui-verifier",
"sui-execution/v0/sui-adapter",
"sui-execution/v0/sui-move-natives",
"sui-execution/v0/sui-verifier",
Expand Down
3 changes: 3 additions & 0 deletions crates/sui-replay-2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ tabled.workspace = true
[build-dependencies]
cynic-codegen.workspace = true

[dev-dependencies]
tempfile.workspace = true

[features]
tracing = [
"sui-types/tracing",
Expand Down
48 changes: 23 additions & 25 deletions crates/sui-replay-2/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,32 +307,30 @@ impl sui_types::storage::ObjectStore for ReplayStore<'_> {
// at the checkpoint (mimic latest runtime behavior)
fn get_object(&self, object_id: &ObjectID) -> Option<Object> {
trace!("get_object({})", object_id);

match self.object_cache.borrow().get(object_id) {
Some(versions) => versions.last_key_value().map(|(_version, obj)| obj.clone()),
None => {
let fetched_object = self
.store
.get_objects(&[ObjectKey {
object_id: *object_id,
version_query: VersionQuery::AtCheckpoint(self.checkpoint),
}])
.map_err(|e| SuiErrorKind::Storage(e.to_string()))
.ok()?
.into_iter()
.next()?
.map(|(obj, _version)| obj)?;

// Add the fetched object to the cache
let mut cache = self.object_cache.borrow_mut();
cache
.entry(*object_id)
.or_default()
.insert(fetched_object.version().value(), fetched_object.clone());

Some(fetched_object)
}
if let Some(cache) = self.object_cache.borrow().get(object_id) {
return cache.last_key_value().map(|(_version, obj)| obj.clone());
}

let fetched_object = self
.store
.get_objects(&[ObjectKey {
object_id: *object_id,
version_query: VersionQuery::AtCheckpoint(self.checkpoint),
}])
.map_err(|e| SuiErrorKind::Storage(e.to_string()))
.ok()?
.into_iter()
.next()?
.map(|(obj, _version)| obj)?;

// Add the fetched object to the cache
let mut cache = self.object_cache.borrow_mut();
cache
.entry(*object_id)
.or_default()
.insert(fetched_object.version().value(), fetched_object.clone());

Some(fetched_object)
}

// Get an object by its ID and version
Expand Down
Loading
Loading