removed redundant VMType enum with one variant (#11266)

This commit is contained in:
Marek Kotewicz
2019-11-20 11:11:36 +08:00
committed by GitHub
parent 82c3265858
commit e0091c672a
18 changed files with 29 additions and 117 deletions

View File

@@ -725,7 +725,7 @@ impl Client {
let trie_factory = TrieFactory::new(trie_spec, Layout);
let factories = Factories {
vm: VmFactory::new(config.vm_type.clone(), config.jump_table_size),
vm: VmFactory::new(config.jump_table_size),
trie: trie_factory,
accountdb: Default::default(),
};

View File

@@ -23,8 +23,6 @@ use trace::Config as TraceConfig;
use types::client_types::Mode;
use verification::{VerifierType, QueueConfig};
pub use evm::VMType;
/// Client state db compaction profile
#[derive(Debug, PartialEq, Clone)]
pub enum DatabaseCompactionProfile {
@@ -64,8 +62,6 @@ pub struct ClientConfig {
pub blockchain: BlockChainConfig,
/// Trace configuration.
pub tracing: TraceConfig,
/// VM type.
pub vm_type: VMType,
/// Fat DB enabled?
pub fat_db: bool,
/// The JournalDB ("pruning") algorithm to use.
@@ -107,7 +103,6 @@ impl Default for ClientConfig {
queue: Default::default(),
blockchain: Default::default(),
tracing: Default::default(),
vm_type: Default::default(),
fat_db: false,
pruning: journaldb::Algorithm::OverlayRecent,
name: "default".into(),

View File

@@ -23,7 +23,7 @@ mod config;
mod traits;
pub use self::client::Client;
pub use self::config::{ClientConfig, DatabaseCompactionProfile, VMType};
pub use self::config::{ClientConfig, DatabaseCompactionProfile};
pub use self::traits::{
ReopenBlock, PrepareOpenBlock, ImportSealedBlock, BroadcastProposalBlock,
Call, EngineInfo, BlockProducer, SealedBlockImporter,

View File

@@ -18,7 +18,7 @@ use std::path::Path;
use std::sync::Arc;
use super::test_common::*;
use account_state::{Backend as StateBackend, State};
use evm::{VMType, Finalize};
use evm::Finalize;
use vm::{
self, ActionParams, CallType, Schedule, Ext,
ContractCreateResult, EnvInfo, MessageCallResult,
@@ -235,17 +235,8 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for TestExt<'a, T, V, B>
}
}
fn do_json_test<H: FnMut(&str, HookType)>(path: &Path, json_data: &[u8], h: &mut H) -> Vec<String> {
let vms = VMType::all();
vms
.iter()
.flat_map(|vm| do_json_test_for(path, vm, json_data, h))
.collect()
}
fn do_json_test_for<H: FnMut(&str, HookType)>(
fn do_json_test<H: FnMut(&str, HookType)>(
path: &Path,
vm_type: &VMType,
json_data: &[u8],
start_stop_hook: &mut H
) -> Vec<String> {
@@ -254,13 +245,13 @@ fn do_json_test_for<H: FnMut(&str, HookType)>(
let mut failed = Vec::new();
for (name, vm) in tests.into_iter() {
start_stop_hook(&format!("{}-{}", name, vm_type), HookType::OnStart);
start_stop_hook(&format!("{}", name), HookType::OnStart);
info!(target: "jsontests", "name: {:?}", name);
let mut fail = false;
let mut fail_unless = |cond: bool, s: &str | if !cond && !fail {
failed.push(format!("[{}] {}: {}", vm_type, name, s));
failed.push(format!("{}: {}", name, s));
fail = true
};
@@ -363,7 +354,7 @@ fn do_json_test_for<H: FnMut(&str, HookType)>(
}
};
start_stop_hook(&format!("{}-{}", name, vm_type), HookType::OnStop);
start_stop_hook(&format!("{}", name), HookType::OnStop);
}
for f in &failed {

View File

@@ -31,7 +31,7 @@ use types::{
};
use ethjson::spec::ForkSpec;
use trie_vm_factories::Factories;
use evm::{VMType, FinalizationResult};
use evm::FinalizationResult;
use vm::{self, ActionParams, CreateContractAddress};
use ethtrie;
use account_state::{CleanupMode, State};
@@ -158,7 +158,7 @@ impl<'a> EvmTestClient<'a> {
fn factories(trie_spec: trie::TrieSpec) -> Factories {
Factories {
vm: trie_vm_factories::VmFactory::new(VMType::Interpreter, 5 * 1024),
vm: trie_vm_factories::VmFactory::new(5 * 1024),
trie: trie::TrieFactory::new(trie_spec, ethtrie::Layout),
accountdb: Default::default(),
}

View File

@@ -19,7 +19,7 @@
use std::sync::Arc;
use hash::keccak;
use vm::{EnvInfo, ActionParams, ActionValue, CallType, ParamsType};
use evm::{Factory, VMType};
use evm::Factory;
use machine::{
executive::Executive,
substate::Substate,