Skip to content

Commit

Permalink
refactor: remove unused INSTNACE_CACHE (#296)
Browse files Browse the repository at this point in the history
loloicci authored Apr 25, 2023

Verified

This commit was signed with the committer’s verified signature.
djhi Gildas Garcia
1 parent 9161e25 commit 00f58c0
Showing 2 changed files with 1 addition and 15 deletions.
13 changes: 0 additions & 13 deletions packages/vm/src/testing/mock.rs
Original file line number Diff line number Diff line change
@@ -2,15 +2,9 @@ use cosmwasm_std::testing::{digit_sum, riffle_shuffle};
use cosmwasm_std::{
Addr, BlockInfo, Coin, ContractInfo, Env, MessageInfo, Timestamp, TransactionInfo,
};
use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::RwLock;
use std::thread_local;
use wasmer::Module;

use super::querier::MockQuerier;
use super::storage::MockStorage;
use crate::instance::Instance;
use crate::{Backend, BackendApi, BackendError, BackendResult, GasInfo};

pub const MOCK_CONTRACT_ADDR: &str = "cosmos2contract";
@@ -39,13 +33,6 @@ pub fn mock_backend_with_balances(
}
}

type MockInstance = Instance<MockApi, MockStorage, MockQuerier>;
thread_local! {
// INSTANCE_CACHE and MODULE_CACHE are intended to replace wasmvm's cache layer in the mock.
// Unlike wasmvm, you have to initialize them yourself in the place where you test the dynamic call.
pub static INSTANCE_CACHE: RwLock<HashMap<String, RefCell<MockInstance>>> = RwLock::new(HashMap::new());
pub static MODULE_CACHE: RwLock<HashMap<String, RefCell<Module>>> = RwLock::new(HashMap::new());
}
/// Length of canonical addresses created with this API. Contracts should not make any assumtions
/// what this value is.
/// The value here must be restorable with `SHUFFLES_ENCODE` + `SHUFFLES_DECODE` in-shuffles.
3 changes: 1 addition & 2 deletions packages/vm/src/testing/mod.rs
Original file line number Diff line number Diff line change
@@ -23,8 +23,7 @@ pub use instance::{
test_io, MockInstanceOptions,
};
pub use mock::{
mock_backend, mock_backend_with_balances, mock_env, mock_info, MockApi, INSTANCE_CACHE,
MOCK_CONTRACT_ADDR,
mock_backend, mock_backend_with_balances, mock_env, mock_info, MockApi, MOCK_CONTRACT_ADDR,
};
pub use querier::MockQuerier;
pub use result::{TestingError, TestingResult};

0 comments on commit 00f58c0

Please sign in to comment.