Skip to content
Draft
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
6 changes: 3 additions & 3 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,9 @@ anemo-cli = { git = "https://github.com/mystenlabs/anemo.git", rev = "845a9b5aab
anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "845a9b5aab1f8b78fb67c0e8e1998cb2e6a4d72e" }

# core-types from the new sdk for use in gRPC
sui-sdk-types = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "1c0451c8c213b79cbfdaa78948742c9e7680504a", features = [ "hash", "serde" ] }
sui-crypto = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "1c0451c8c213b79cbfdaa78948742c9e7680504a", features = [ "ed25519", "secp256r1", "secp256k1", "passkey", "zklogin", "mldsa65" ] }
sui-rpc = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "1c0451c8c213b79cbfdaa78948742c9e7680504a", features = [ "unstable" ] }
sui-sdk-types = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "9d6cfabd67c586892e6ac68e722eb7ee9b7459cf", features = [ "hash", "serde" ] }
sui-crypto = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "9d6cfabd67c586892e6ac68e722eb7ee9b7459cf", features = [ "ed25519", "secp256r1", "secp256k1", "passkey", "zklogin", "mldsa65" ] }
sui-rpc = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "9d6cfabd67c586892e6ac68e722eb7ee9b7459cf", features = [ "unstable" ] }

### Workspace Members ###
anemo-benchmark = { path = "crates/anemo-benchmark" }
Expand Down
16 changes: 16 additions & 0 deletions crates/simulacrum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,22 @@ impl<T: Send + Sync, V: store::SimulatorStore + Send + Sync> RpcStateReader for
fn indexes(&self) -> Option<&dyn sui_types::storage::RpcIndexes> {
None
}

/// The store records no versions at which objects were deleted or wrapped, so only a live
/// object at or below `version` can be answered exactly. Any other read fails rather than
/// return a version the object may already have left.
fn get_object_lt_or_eq_version(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> sui_types::storage::error::Result<Option<Object>> {
match store::SimulatorStore::get_object(self.store(), object_id) {
Some(object) if object.version() <= version => Ok(Some(object)),
_ => Err(sui_types::storage::error::Error::custom(
"Simulacrum only serves version-bounded reads of live objects at or below the bound",
)),
}
}
}

impl Simulacrum {
Expand Down
27 changes: 27 additions & 0 deletions crates/sui-core/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ impl RocksDbStore {
.multi_get_objects_by_key(object_keys)
}

/// See [`crate::execution_cache::ObjectCacheRead::find_object_lt_or_eq_version`].
pub fn find_object_lt_or_eq_version(
&self,
object_id: ObjectID,
version: SequenceNumber,
) -> Option<Object> {
self.cache_traits
.object_cache_reader
.find_object_lt_or_eq_version(object_id, version)
}

pub fn get_last_executed_checkpoint(&self) -> Option<VerifiedCheckpoint> {
self.checkpoint_store
.get_highest_executed_checkpoint()
Expand Down Expand Up @@ -695,6 +706,14 @@ impl RpcStateReader for RestReadStore {
fn layout_package_store(&self) -> Box<dyn BackingPackageStore + Send + Sync + '_> {
Box::new(self.state.get_backing_package_store().as_ref())
}

fn get_object_lt_or_eq_version(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> Result<Option<Object>> {
Ok(self.rocks.find_object_lt_or_eq_version(*object_id, version))
}
}

/// Read store backed by the embedded [`sui_rpc_store`] indexer.
Expand Down Expand Up @@ -960,6 +979,14 @@ impl RpcStateReader for RpcStoreReadStore {
Some(self)
}

fn get_object_lt_or_eq_version(
&self,
object_id: &ObjectID,
version: SequenceNumber,
) -> Result<Option<Object>> {
Ok(self.rocks.find_object_lt_or_eq_version(*object_id, version))
}

fn get_highest_executed_checkpoint_seq_number(&self) -> Result<CheckpointSequenceNumber> {
// The raw executed tip, read straight from the checkpoint store. Unlike
// `get_latest_checkpoint`, this is not bounded to the live-object index
Expand Down
Loading
Loading