diff --git a/Cargo.lock b/Cargo.lock index 8edefe8f2457b..17fba8e8bcbbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9479,7 +9479,6 @@ name = "simulacrum" version = "0.1.0" dependencies = [ "anyhow", - "async-trait", "bcs", "fastcrypto", "move-binary-format", diff --git a/crates/simulacrum/Cargo.toml b/crates/simulacrum/Cargo.toml index 11d041ce1be73..a3ddc6e8ef843 100644 --- a/crates/simulacrum/Cargo.toml +++ b/crates/simulacrum/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" [dependencies] anyhow.workspace = true -async-trait.workspace = true bcs.workspace = true fastcrypto.workspace = true move-binary-format.workspace = true diff --git a/crates/simulacrum/src/store.rs b/crates/simulacrum/src/store.rs index cef9ed057ce68..a7c655e7053b5 100644 --- a/crates/simulacrum/src/store.rs +++ b/crates/simulacrum/src/store.rs @@ -410,61 +410,50 @@ impl KeyStore { } } -#[async_trait::async_trait] pub trait SimulatorStore: sui_types::storage::BackingPackageStore + sui_types::storage::ObjectStore + sui_types::storage::ReceivedMarkerQuery { - async fn get_checkpoint_by_sequence_number( + fn get_checkpoint_by_sequence_number( &self, sequence_number: CheckpointSequenceNumber, ) -> Option<&VerifiedCheckpoint>; - async fn get_checkpoint_by_digest( - &self, - digest: &CheckpointDigest, - ) -> Option<&VerifiedCheckpoint>; + fn get_checkpoint_by_digest(&self, digest: &CheckpointDigest) -> Option<&VerifiedCheckpoint>; - async fn get_highest_checkpint(&self) -> Option<&VerifiedCheckpoint>; - async fn get_checkpoint_contents( + fn get_highest_checkpint(&self) -> Option<&VerifiedCheckpoint>; + fn get_checkpoint_contents( &self, digest: &CheckpointContentsDigest, ) -> Option<&CheckpointContents>; - async fn get_committee_by_epoch(&self, epoch: EpochId) -> Option<&Committee>; + fn get_committee_by_epoch(&self, epoch: EpochId) -> Option<&Committee>; - async fn get_transaction(&self, digest: &TransactionDigest) -> Option<&VerifiedTransaction>; + fn get_transaction(&self, digest: &TransactionDigest) -> Option<&VerifiedTransaction>; - async fn get_transaction_effects( - &self, - digest: &TransactionDigest, - ) -> Option<&TransactionEffects>; - async fn get_transaction_events( + fn get_transaction_effects(&self, digest: &TransactionDigest) -> Option<&TransactionEffects>; + fn get_transaction_events( &self, digest: &TransactionEventsDigest, ) -> Option<&TransactionEvents>; - async fn get_object(&self, id: &ObjectID) -> Option<&Object>; - async fn get_object_at_version( - &self, - id: &ObjectID, - version: SequenceNumber, - ) -> Option<&Object>; + fn get_object(&self, id: &ObjectID) -> Option<&Object>; + fn get_object_at_version(&self, id: &ObjectID, version: SequenceNumber) -> Option<&Object>; - async fn get_system_state(&self) -> sui_types::sui_system_state::SuiSystemState; + fn get_system_state(&self) -> sui_types::sui_system_state::SuiSystemState; - async fn get_clock(&self) -> sui_types::clock::Clock; + fn get_clock(&self) -> sui_types::clock::Clock; - async fn owned_objects(&self, owner: SuiAddress) -> Box + '_>; + fn owned_objects(&self, owner: SuiAddress) -> Box + '_>; - async fn insert_checkpoint(&mut self, checkpoint: VerifiedCheckpoint); + fn insert_checkpoint(&mut self, checkpoint: VerifiedCheckpoint); - async fn insert_checkpoint_contents(&mut self, contents: CheckpointContents); + fn insert_checkpoint_contents(&mut self, contents: CheckpointContents); - async fn insert_committee(&mut self, committee: Committee); + fn insert_committee(&mut self, committee: Committee); - async fn insert_executed_transaction( + fn insert_executed_transaction( &mut self, transaction: VerifiedTransaction, effects: TransactionEffects, @@ -472,105 +461,94 @@ pub trait SimulatorStore: written_objects: BTreeMap, ); - async fn insert_transaction(&mut self, transaction: VerifiedTransaction); + fn insert_transaction(&mut self, transaction: VerifiedTransaction); - async fn insert_transaction_effects(&mut self, effects: TransactionEffects); + fn insert_transaction_effects(&mut self, effects: TransactionEffects); - async fn insert_events(&mut self, events: TransactionEvents); + fn insert_events(&mut self, events: TransactionEvents); - async fn update_objects( + fn update_objects( &mut self, written_objects: BTreeMap, deleted_objects: Vec<(ObjectID, SequenceNumber, ObjectDigest)>, ); } -#[async_trait::async_trait] impl SimulatorStore for InMemoryStore { - async fn get_checkpoint_by_sequence_number( + fn get_checkpoint_by_sequence_number( &self, sequence_number: CheckpointSequenceNumber, ) -> Option<&VerifiedCheckpoint> { self.get_checkpoint_by_sequence_number(sequence_number) } - async fn get_checkpoint_by_digest( - &self, - digest: &CheckpointDigest, - ) -> Option<&VerifiedCheckpoint> { + fn get_checkpoint_by_digest(&self, digest: &CheckpointDigest) -> Option<&VerifiedCheckpoint> { self.get_checkpoint_by_digest(digest) } - async fn get_highest_checkpint(&self) -> Option<&VerifiedCheckpoint> { + fn get_highest_checkpint(&self) -> Option<&VerifiedCheckpoint> { self.get_highest_checkpint() } - async fn get_checkpoint_contents( + fn get_checkpoint_contents( &self, digest: &CheckpointContentsDigest, ) -> Option<&CheckpointContents> { self.get_checkpoint_contents(digest) } - async fn get_committee_by_epoch(&self, epoch: EpochId) -> Option<&Committee> { + fn get_committee_by_epoch(&self, epoch: EpochId) -> Option<&Committee> { self.get_committee_by_epoch(epoch) } - async fn get_transaction(&self, digest: &TransactionDigest) -> Option<&VerifiedTransaction> { + fn get_transaction(&self, digest: &TransactionDigest) -> Option<&VerifiedTransaction> { self.get_transaction(digest) } - async fn get_transaction_effects( - &self, - digest: &TransactionDigest, - ) -> Option<&TransactionEffects> { + fn get_transaction_effects(&self, digest: &TransactionDigest) -> Option<&TransactionEffects> { self.get_transaction_effects(digest) } - async fn get_transaction_events( + fn get_transaction_events( &self, digest: &TransactionEventsDigest, ) -> Option<&TransactionEvents> { self.get_transaction_events(digest) } - async fn get_object(&self, id: &ObjectID) -> Option<&Object> { + fn get_object(&self, id: &ObjectID) -> Option<&Object> { self.get_object(id) } - async fn get_object_at_version( - &self, - id: &ObjectID, - version: SequenceNumber, - ) -> Option<&Object> { + fn get_object_at_version(&self, id: &ObjectID, version: SequenceNumber) -> Option<&Object> { self.get_object_at_version(id, version) } - async fn get_system_state(&self) -> sui_types::sui_system_state::SuiSystemState { + fn get_system_state(&self) -> sui_types::sui_system_state::SuiSystemState { self.get_system_state() } - async fn get_clock(&self) -> sui_types::clock::Clock { + fn get_clock(&self) -> sui_types::clock::Clock { self.get_clock() } - async fn owned_objects(&self, owner: SuiAddress) -> Box + '_> { + fn owned_objects(&self, owner: SuiAddress) -> Box + '_> { Box::new(self.owned_objects(owner)) } - async fn insert_checkpoint(&mut self, checkpoint: VerifiedCheckpoint) { + fn insert_checkpoint(&mut self, checkpoint: VerifiedCheckpoint) { self.insert_checkpoint(checkpoint) } - async fn insert_checkpoint_contents(&mut self, contents: CheckpointContents) { + fn insert_checkpoint_contents(&mut self, contents: CheckpointContents) { self.insert_checkpoint_contents(contents) } - async fn insert_committee(&mut self, committee: Committee) { + fn insert_committee(&mut self, committee: Committee) { self.insert_committee(committee) } - async fn insert_executed_transaction( + fn insert_executed_transaction( &mut self, transaction: VerifiedTransaction, effects: TransactionEffects, @@ -580,19 +558,19 @@ impl SimulatorStore for InMemoryStore { self.insert_executed_transaction(transaction, effects, events, written_objects) } - async fn insert_transaction(&mut self, transaction: VerifiedTransaction) { + fn insert_transaction(&mut self, transaction: VerifiedTransaction) { self.insert_transaction(transaction) } - async fn insert_transaction_effects(&mut self, effects: TransactionEffects) { + fn insert_transaction_effects(&mut self, effects: TransactionEffects) { self.insert_transaction_effects(effects) } - async fn insert_events(&mut self, events: TransactionEvents) { + fn insert_events(&mut self, events: TransactionEvents) { self.insert_events(events) } - async fn update_objects( + fn update_objects( &mut self, written_objects: BTreeMap, deleted_objects: Vec<(ObjectID, SequenceNumber, ObjectDigest)>,