[cita-executor] fix tests helpers
@@ -23,8 +23,6 @@ use self::tempdir::TempDir;
use crate::libexecutor::block::{BlockBody, ClosedBlock, OpenBlock};
use crate::libexecutor::command;
use crate::libexecutor::executor::Executor;
-use crate::state::State;
-use crate::state_db::*;
use crate::types::header::OpenHeader;
use crate::types::transaction::SignedTransaction;
use cita_crypto::PrivKey;
@@ -39,27 +37,20 @@ use std::io::Read;
use std::io::Write;
use std::path::Path;
use std::process::Command;
-use std::sync::Arc;
use std::time::UNIX_EPOCH;
use util::AsMillis;
-const CHAIN_CONFIG: &str = "chain.toml";
-const SCRIPTS_DIR: &str = "../../scripts";
+use std::sync::Arc;
-// pub fn get_temp_state() -> State<StateDB> {
-// let state_db = get_temp_state_db();
-// State::new(state_db, 0.into(), Default::default())
-// }
+use cita_vm::{state::MemoryDB, state::State};
-// fn new_db() -> Arc<KeyValueDB> {
-// Arc::new(kvdb::in_memory(8))
-// }
+const CHAIN_CONFIG: &str = "chain.toml";
+const SCRIPTS_DIR: &str = "../../scripts";
-// pub fn get_temp_state_db() -> StateDB {
-// let db = new_db();
-// let journal_db = journaldb::new(db, journaldb::Algorithm::Archive, crate::db::COL_STATE);
-// StateDB::new(journal_db, 5 * 1024 * 1024)
-// }
+pub fn get_temp_state() -> State<MemoryDB> {
+ let db = Arc::new(MemoryDB::new(false));
+ State::new(db).unwrap()
+}
pub fn solc(name: &str, source: &str) -> (Vec<u8>, Vec<u8>) {
// input and output of solc command
@@ -129,9 +120,7 @@ pub fn init_executor2(
env::set_var("DATA_PATH", data_path);
let executor = Executor::init(
genesis_path.to_str().unwrap(),
- "archive",
- 5 * 1024 * 1024,
- tempdir.to_str().unwrap().to_string(),
+ "archive".to_string(),
fsm_req_receiver,
fsm_resp_sender,
command_req_receiver,
