diff --git a/aptos-move/aptos-aggregator/src/delta_change_set.rs b/aptos-move/aptos-aggregator/src/delta_change_set.rs index 4b2c67753a807..237de82af7074 100644 --- a/aptos-move/aptos-aggregator/src/delta_change_set.rs +++ b/aptos-move/aptos-aggregator/src/delta_change_set.rs @@ -567,10 +567,6 @@ mod test { ))) } - fn is_genesis(&self) -> bool { - unreachable!() - } - fn get_usage(&self) -> anyhow::Result { unreachable!() } diff --git a/aptos-move/aptos-validator-interface/src/lib.rs b/aptos-move/aptos-validator-interface/src/lib.rs index df7c056973eeb..aa2f9ecd65825 100644 --- a/aptos-move/aptos-validator-interface/src/lib.rs +++ b/aptos-move/aptos-validator-interface/src/lib.rs @@ -192,10 +192,6 @@ impl TStateView for DebuggerStateView { self.get_state_value_internal(state_key, self.version) } - fn is_genesis(&self) -> bool { - false - } - fn get_usage(&self) -> Result { unimplemented!() } diff --git a/aptos-move/aptos-vm/src/move_vm_ext/respawned_session.rs b/aptos-move/aptos-vm/src/move_vm_ext/respawned_session.rs index 72950c39bab40..521b0640adbd0 100644 --- a/aptos-move/aptos-vm/src/move_vm_ext/respawned_session.rs +++ b/aptos-move/aptos-vm/src/move_vm_ext/respawned_session.rs @@ -118,10 +118,6 @@ impl<'r> TStateView for ChangeSetStateView<'r> { } } - fn is_genesis(&self) -> bool { - unreachable!("Unexpected access to is_genesis()") - } - fn get_usage(&self) -> Result { bail!("Unexpected access to get_usage()") } diff --git a/aptos-move/aptos-vm/src/sharded_block_executor/cross_shard_state_view.rs b/aptos-move/aptos-vm/src/sharded_block_executor/cross_shard_state_view.rs index 5c254b4610373..c2d25a4618d7b 100644 --- a/aptos-move/aptos-vm/src/sharded_block_executor/cross_shard_state_view.rs +++ b/aptos-move/aptos-vm/src/sharded_block_executor/cross_shard_state_view.rs @@ -131,10 +131,6 @@ impl<'a, S: StateView + Sync + Send> TStateView for CrossShardStateView<'a, S> { self.base_view.get_state_value(state_key) } - fn is_genesis(&self) -> bool { - unimplemented!("is_genesis is not implemented for InMemoryStateView") - } - fn get_usage(&self) -> Result { Ok(StateStorageUsage::new_untracked()) } diff --git a/aptos-move/block-executor/src/proptest_types/types.rs b/aptos-move/block-executor/src/proptest_types/types.rs index 356e994289d60..1496abcbc9fa9 100644 --- a/aptos-move/block-executor/src/proptest_types/types.rs +++ b/aptos-move/block-executor/src/proptest_types/types.rs @@ -63,10 +63,6 @@ where StateViewId::Miscellaneous } - fn is_genesis(&self) -> bool { - unreachable!(); - } - fn get_usage(&self) -> anyhow::Result { unreachable!(); } @@ -92,10 +88,6 @@ where StateViewId::Miscellaneous } - fn is_genesis(&self) -> bool { - unreachable!(); - } - fn get_usage(&self) -> anyhow::Result { unreachable!(); } diff --git a/aptos-move/block-executor/src/view.rs b/aptos-move/block-executor/src/view.rs index 970a495c27a9e..d14a0c3190a25 100644 --- a/aptos-move/block-executor/src/view.rs +++ b/aptos-move/block-executor/src/view.rs @@ -292,10 +292,6 @@ impl<'a, T: Transaction, S: TStateView, X: Executable> TStateView self.base_view.id() } - fn is_genesis(&self) -> bool { - self.base_view.is_genesis() - } - fn get_usage(&self) -> Result { self.base_view.get_usage() } diff --git a/aptos-move/e2e-tests/src/data_store.rs b/aptos-move/e2e-tests/src/data_store.rs index f63e08c8fd05e..c0bcdbbe2868d 100644 --- a/aptos-move/e2e-tests/src/data_store.rs +++ b/aptos-move/e2e-tests/src/data_store.rs @@ -122,10 +122,6 @@ impl TStateView for FakeDataStore { Ok(self.state_data.get(state_key).cloned()) } - fn is_genesis(&self) -> bool { - self.state_data.is_empty() - } - fn get_usage(&self) -> Result { let mut usage = StateStorageUsage::new_untracked(); for (k, v) in self.state_data.iter() { diff --git a/aptos-move/vm-genesis/src/genesis_context.rs b/aptos-move/vm-genesis/src/genesis_context.rs index 1de641636b520..b73ef3c2248bc 100644 --- a/aptos-move/vm-genesis/src/genesis_context.rs +++ b/aptos-move/vm-genesis/src/genesis_context.rs @@ -46,10 +46,6 @@ impl TStateView for GenesisStateView { .map(StateValue::new_legacy)) } - fn is_genesis(&self) -> bool { - true - } - fn get_usage(&self) -> Result { Ok(StateStorageUsage::zero()) } diff --git a/execution/executor/src/mock_vm/mock_vm_test.rs b/execution/executor/src/mock_vm/mock_vm_test.rs index 05cbd65739387..21cbab6817b1e 100644 --- a/execution/executor/src/mock_vm/mock_vm_test.rs +++ b/execution/executor/src/mock_vm/mock_vm_test.rs @@ -28,10 +28,6 @@ impl TStateView for MockStateView { Ok(None) } - fn is_genesis(&self) -> bool { - false - } - fn get_usage(&self) -> Result { Ok(StateStorageUsage::new_untracked()) } diff --git a/execution/executor/src/mock_vm/mod.rs b/execution/executor/src/mock_vm/mod.rs index 5e65c9f2d85d2..aae52c233bd17 100644 --- a/execution/executor/src/mock_vm/mod.rs +++ b/execution/executor/src/mock_vm/mod.rs @@ -81,27 +81,6 @@ impl VMExecutor for MockVM { state_view: &impl StateView, _maybe_block_gas_limit: Option, ) -> Result, VMStatus> { - if state_view.is_genesis() { - assert_eq!( - transactions.len(), - 1, - "Genesis block should have only one transaction." - ); - let output = TransactionOutput::new( - gen_genesis_writeset(), - // mock the validator set event - vec![ContractEvent::new( - new_epoch_event_key(), - 0, - TypeTag::Bool, - bcs::to_bytes(&0).unwrap(), - )], - 0, - KEEP_STATUS.clone(), - ); - return Ok(vec![output]); - } - // output_cache is used to store the output of transactions so they are visible to later // transactions. let mut output_cache = HashMap::new(); diff --git a/storage/state-view/src/in_memory_state_view.rs b/storage/state-view/src/in_memory_state_view.rs index 36fe5c2d9d7c3..37a64b1aaa08f 100644 --- a/storage/state-view/src/in_memory_state_view.rs +++ b/storage/state-view/src/in_memory_state_view.rs @@ -29,10 +29,6 @@ impl TStateView for InMemoryStateView { Ok(self.state_data.get(state_key).cloned()) } - fn is_genesis(&self) -> bool { - unimplemented!("is_genesis is not implemented for InMemoryStateView") - } - fn get_usage(&self) -> Result { Ok(StateStorageUsage::new_untracked()) } diff --git a/storage/state-view/src/lib.rs b/storage/state-view/src/lib.rs index f52017ef34cf9..12353886afd73 100644 --- a/storage/state-view/src/lib.rs +++ b/storage/state-view/src/lib.rs @@ -45,10 +45,6 @@ pub trait TStateView { /// Gets the state value for a given state key. fn get_state_value(&self, state_key: &Self::Key) -> Result>; - /// VM needs this method to know whether the current state view is for genesis state creation. - /// Currently TransactionPayload::WriteSet is only valid for genesis state creation. - fn is_genesis(&self) -> bool; - /// Get state storage usage info at epoch ending. fn get_usage(&self) -> Result; @@ -88,10 +84,6 @@ where self.deref().get_state_value(state_key) } - fn is_genesis(&self) -> bool { - self.deref().is_genesis() - } - fn get_usage(&self) -> Result { self.deref().get_usage() } diff --git a/storage/storage-interface/src/cached_state_view.rs b/storage/storage-interface/src/cached_state_view.rs index 48ce53993092f..731f9138b68de 100644 --- a/storage/storage-interface/src/cached_state_view.rs +++ b/storage/storage-interface/src/cached_state_view.rs @@ -222,10 +222,6 @@ impl TStateView for CachedStateView { Ok(value_opt.clone()) } - fn is_genesis(&self) -> bool { - self.snapshot.is_none() - } - fn get_usage(&self) -> Result { Ok(self.speculative_state.usage()) } @@ -267,10 +263,6 @@ impl TStateView for CachedDbStateView { Ok(new_value.clone()) } - fn is_genesis(&self) -> bool { - self.db_state_view.is_genesis() - } - fn get_usage(&self) -> Result { self.db_state_view.get_usage() } diff --git a/storage/storage-interface/src/state_view.rs b/storage/storage-interface/src/state_view.rs index d29d593cdd285..e88b9f7254faf 100644 --- a/storage/storage-interface/src/state_view.rs +++ b/storage/storage-interface/src/state_view.rs @@ -35,10 +35,6 @@ impl TStateView for DbStateView { self.get(state_key) } - fn is_genesis(&self) -> bool { - self.version.is_none() - } - fn get_usage(&self) -> Result { self.db.get_state_storage_usage(self.version) }