Commit 779cef21 authored by Andrew Jones's avatar Andrew Jones

Remove remaining ink 1.0 impl

parent 55041d5e
...@@ -175,8 +175,6 @@ impl StorageEntry { ...@@ -175,8 +175,6 @@ impl StorageEntry {
pub struct TestEnvData { pub struct TestEnvData {
/// The storage entries. /// The storage entries.
storage: HashMap<Key, StorageEntry>, storage: HashMap<Key, StorageEntry>,
/// The runtime storage entries
runtime_storage: HashMap<Vec<u8>, StorageEntry>,
/// The address of the contract. /// The address of the contract.
/// ///
/// # Note /// # Note
...@@ -250,7 +248,6 @@ impl Default for TestEnvData { ...@@ -250,7 +248,6 @@ impl Default for TestEnvData {
Self { Self {
address: Vec::new(), address: Vec::new(),
storage: HashMap::new(), storage: HashMap::new(),
runtime_storage: HashMap::new(),
balance: Vec::new(), balance: Vec::new(),
caller: Vec::new(), caller: Vec::new(),
input: Vec::new(), input: Vec::new(),
...@@ -279,7 +276,6 @@ impl TestEnvData { ...@@ -279,7 +276,6 @@ impl TestEnvData {
self.address.clear(); self.address.clear();
self.balance.clear(); self.balance.clear();
self.storage.clear(); self.storage.clear();
self.runtime_storage.clear();
self.caller.clear(); self.caller.clear();
self.input.clear(); self.input.clear();
self.random_seed.clear(); self.random_seed.clear();
...@@ -439,16 +435,6 @@ impl TestEnvData { ...@@ -439,16 +435,6 @@ impl TestEnvData {
pub fn set_next_create_address(&mut self, account_id: &[u8]) { pub fn set_next_create_address(&mut self, account_id: &[u8]) {
self.next_create_address = account_id.to_vec(); self.next_create_address = account_id.to_vec();
} }
/// Sets the runtime storage value
pub fn set_runtime_storage(&mut self, key: Vec<u8>, value: &[u8]) {
match self.runtime_storage.entry(key) {
Entry::Occupied(mut occupied) => occupied.get_mut().write(value.to_vec()),
Entry::Vacant(vacant) => {
vacant.insert(StorageEntry::new(value.to_vec()));
}
}
}
} }
impl TestEnvData { impl TestEnvData {
...@@ -621,14 +607,6 @@ where ...@@ -621,14 +607,6 @@ where
.set_next_create_address(&account_id.encode()) .set_next_create_address(&account_id.encode())
}) })
} }
pub fn set_runtime_storage<U: scale::Encode>(key: Vec<u8>, value: U) {
TEST_ENV_DATA.with(|test_env| {
test_env
.borrow_mut()
.set_runtime_storage(key, &value.encode())
})
}
impl_env_setters_for_test_env!( impl_env_setters_for_test_env!(
(set_address, address, T::AccountId), (set_address, address, T::AccountId),
(set_balance, balance, T::Balance), (set_balance, balance, T::Balance),
...@@ -802,16 +780,6 @@ where ...@@ -802,16 +780,6 @@ where
.map_err(|_| CreateError) .map_err(|_| CreateError)
}) })
} }
fn runtime_get_storage<U: Decode>(key: &[u8]) -> Option<Result<U, scale::Error>> {
TEST_ENV_DATA.with(|test_env| {
test_env
.borrow_mut()
.runtime_storage
.get(key)
.map(|value| Decode::decode(&mut &value.data[..]))
})
}
} }
pub enum TestEnvStorage {} pub enum TestEnvStorage {}
......
...@@ -179,7 +179,4 @@ pub trait Env: EnvTypes { ...@@ -179,7 +179,4 @@ pub trait Env: EnvTypes {
value: <Self as EnvTypes>::Balance, value: <Self as EnvTypes>::Balance,
input_data: &[u8], input_data: &[u8],
) -> Result<<Self as EnvTypes>::AccountId, CreateError>; ) -> Result<<Self as EnvTypes>::AccountId, CreateError>;
/// Returns the runtime storage value at the given key
fn runtime_get_storage<U: Decode>(key: &[u8]) -> Option<Result<U, scale::Error>>;
} }
...@@ -220,9 +220,4 @@ impl<T: Env> EnvHandler<T> { ...@@ -220,9 +220,4 @@ impl<T: Env> EnvHandler<T> {
) -> Result<U, CallError> { ) -> Result<U, CallError> {
T::call_evaluate(callee, gas, value, input_data) T::call_evaluate(callee, gas, value, input_data)
} }
/// Returns the runtime storage value at the given key
pub fn runtime_get_storage<U: Decode>(&self, key: &[u8]) -> Option<Result<U, scale::Error>> {
T::runtime_get_storage::<U>(key)
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment