diff --git a/execution_engine/src/runtime_context/mod.rs b/execution_engine/src/runtime_context/mod.rs index 4168e69bc9..3b14f0c29b 100644 --- a/execution_engine/src/runtime_context/mod.rs +++ b/execution_engine/src/runtime_context/mod.rs @@ -61,11 +61,6 @@ pub enum AllowInstallUpgrade { Forbidden, } -enum PackageFootprint { - Package(Package), - ContractPackage(ContractPackage), -} - /// Holds information specific to the deployed contract. pub struct RuntimeContext<'a, R> { tracking_copy: Rc>>, diff --git a/execution_engine/src/runtime_context/tests.rs b/execution_engine/src/runtime_context/tests.rs index 6137fa982b..cf864e25d4 100644 --- a/execution_engine/src/runtime_context/tests.rs +++ b/execution_engine/src/runtime_context/tests.rs @@ -926,7 +926,7 @@ fn remove_uref_works() { let next_session_access_rights = footprint .borrow() - .extract_access_rights(entity_hash.value(), &entity_named_keys); + .extract_access_rights(entity_hash.value()); let address_generator = AddressGenerator::new(&deploy_hash, Phase::Session); let (runtime_context, _tempdir) = new_runtime_context( diff --git a/execution_engine_testing/test_support/src/wasm_test_builder.rs b/execution_engine_testing/test_support/src/wasm_test_builder.rs index af2998029a..6ca0ccc132 100644 --- a/execution_engine_testing/test_support/src/wasm_test_builder.rs +++ b/execution_engine_testing/test_support/src/wasm_test_builder.rs @@ -1424,6 +1424,7 @@ where self } + /// Returns the `Account` if present. pub fn get_account(&self, account_hash: AccountHash) -> Option { let stored_value = self .query(None, Key::Account(account_hash), &[]) diff --git a/execution_engine_testing/tests/src/test/contract_api/get_call_stack.rs b/execution_engine_testing/tests/src/test/contract_api/get_call_stack.rs index b62ca7c27d..477fd572a3 100644 --- a/execution_engine_testing/tests/src/test/contract_api/get_call_stack.rs +++ b/execution_engine_testing/tests/src/test/contract_api/get_call_stack.rs @@ -77,17 +77,15 @@ fn execute_and_assert_result( ) { if call_depth == 0 { builder.exec(execute_request).commit().expect_success(); - } else { - if is_invalid_context { - builder.exec(execute_request).commit().expect_failure(); - let error = builder.get_error().expect("must have an error"); - assert!(matches!( - error, - // Call chains have stored contract trying to call stored session which we don't - // support and is an actual error. - CoreError::Exec(ExecError::InvalidContext) - )); - } + } else if is_invalid_context { + builder.exec(execute_request).commit().expect_failure(); + let error = builder.get_error().expect("must have an error"); + assert!(matches!( + error, + // Call chains have stored contract trying to call stored session which we don't + // support and is an actual error. + CoreError::Exec(ExecError::InvalidContext) + )); } } diff --git a/execution_engine_testing/tests/src/test/groups.rs b/execution_engine_testing/tests/src/test/groups.rs index daeb6feaa3..2635e712d3 100644 --- a/execution_engine_testing/tests/src/test/groups.rs +++ b/execution_engine_testing/tests/src/test/groups.rs @@ -12,10 +12,10 @@ use casper_execution_engine::{engine_state::Error, execution::ExecError}; use casper_types::{ account::AccountHash, contracts::{ContractPackageHash, CONTRACT_INITIAL_VERSION}, - runtime_args, HoldBalanceHandling, Key, PackageHash, RuntimeArgs, Timestamp, U512, + runtime_args, Key, PackageHash, RuntimeArgs, U512, }; -use crate::{lmdb_fixture, wasm_utils}; +use crate::wasm_utils; const CONTRACT_GROUPS: &str = "groups.wasm"; const PACKAGE_HASH_KEY: &str = "package_hash_key"; @@ -34,8 +34,6 @@ const CALL_RESTRICTED_ENTRY_POINTS: &str = "call_restricted_entry_points"; const ARG_AMOUNT: &str = "amount"; const ARG_TARGET: &str = "target"; -const GROUPS_FIXTURE: &str = "groups"; - static TRANSFER_1_AMOUNT: Lazy = Lazy::new(|| U512::from(MINIMUM_ACCOUNT_CREATION_BALANCE) + 1000); diff --git a/smart_contracts/contracts/test/get-call-stack-recursive-subcall/src/main.rs b/smart_contracts/contracts/test/get-call-stack-recursive-subcall/src/main.rs index 911b6f8e18..e48631e0ff 100644 --- a/smart_contracts/contracts/test/get-call-stack-recursive-subcall/src/main.rs +++ b/smart_contracts/contracts/test/get-call-stack-recursive-subcall/src/main.rs @@ -7,8 +7,8 @@ use alloc::{boxed::Box, string::ToString, vec}; use casper_contract::contract_api::{runtime, storage}; use casper_types::{ - AddressableEntityHash, CLType, EntryPoint, EntryPointAccess, EntryPointPayment, EntryPointType, - EntryPoints, Key, Parameter, + CLType, EntryPoint, EntryPointAccess, EntryPointPayment, EntryPointType, EntryPoints, Key, + Parameter, }; use get_call_stack_recursive_subcall::{ diff --git a/smart_contracts/contracts/test/manage-groups/src/main.rs b/smart_contracts/contracts/test/manage-groups/src/main.rs index 4c9336a8d3..d8f0dc6548 100644 --- a/smart_contracts/contracts/test/manage-groups/src/main.rs +++ b/smart_contracts/contracts/test/manage-groups/src/main.rs @@ -23,7 +23,7 @@ use casper_types::{ api_error, bytesrepr::{self, ToBytes}, contracts::{ContractPackage, ContractPackageHash, NamedKeys}, - ApiError, CLType, EntryPointPayment, Group, Key, Package, PackageHash, Parameter, URef, + ApiError, CLType, EntryPointPayment, Group, Key, Parameter, URef, }; const PACKAGE_HASH_KEY: &str = "package_hash_key"; diff --git a/storage/src/tracking_copy/ext_entity.rs b/storage/src/tracking_copy/ext_entity.rs index dc59b18dec..b1b9c29eab 100644 --- a/storage/src/tracking_copy/ext_entity.rs +++ b/storage/src/tracking_copy/ext_entity.rs @@ -1,5 +1,5 @@ use std::collections::BTreeSet; -use tracing::{debug, error, info}; +use tracing::{debug, error}; use casper_types::{ account::AccountHash, @@ -160,16 +160,6 @@ where &self, entity_addr: EntityAddr, ) -> Result { - let key = if self.enable_addressable_entity { - Key::AddressableEntity(entity_addr) - } else { - match entity_addr { - EntityAddr::System(system_hash_addr) => Key::Hash(system_hash_addr), - EntityAddr::Account(account_hash) => Key::Account(AccountHash::new(account_hash)), - EntityAddr::SmartContract(contract_hash_addr) => Key::Hash(contract_hash_addr), - } - }; - let entity_key = match entity_addr { EntityAddr::Account(account_addr) => { let account_key = Key::Account(AccountHash::new(account_addr)); @@ -177,10 +167,7 @@ where Some(StoredValue::Account(account)) => { return Ok(RuntimeFootprint::new_account_footprint(account)) } - Some(StoredValue::CLValue(cl_value)) => { - let key = cl_value.to_t::()?; - key - } + Some(StoredValue::CLValue(cl_value)) => cl_value.to_t::()?, Some(other) => { return Err(TrackingCopyError::TypeMismatch( StoredValueTypeMismatch::new( @@ -222,10 +209,7 @@ where maybe_system_entity_type, )); } - Some(StoredValue::CLValue(cl_value)) => { - let key = cl_value.to_t::()?; - key - } + Some(StoredValue::CLValue(cl_value)) => cl_value.to_t::()?, Some(_) | None => Key::AddressableEntity(entity_addr), } } @@ -406,7 +390,6 @@ where } }; let mint = self.runtime_footprint_by_hash_addr(mint_hash)?; - let mint_named_keys = mint.named_keys(); let mint_access_rights = mint.extract_access_rights(mint_hash); (mint.take_named_keys(), mint_access_rights) };