mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-25 10:28:00 +00:00
90fb89adc0
* Add a barebones common crate * Refactor some code into the common crate * Add a `ResolverApi` interface. This commit adds a `ResolverApi` trait to the `format` crate that can be implemented by any type that can act as a resolver. A resolver is able to provide information on the chain state. This chain state could be fresh or it could be cached (which is something that we will do in a future PR). This cleans up our crate graph so that `format` is not depending on the node interactions crate for the `EthereumNode` trait. * Cleanup the blocking executor
48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
//! The revive differential testing core library.
|
|
//!
|
|
//! This crate defines the testing configuration and
|
|
//! provides a helper utility to execute tests.
|
|
|
|
use revive_dt_compiler::{SolidityCompiler, revive_resolc, solc};
|
|
use revive_dt_config::TestingPlatform;
|
|
use revive_dt_format::traits::ResolverApi;
|
|
use revive_dt_node::{Node, geth, kitchensink::KitchensinkNode};
|
|
use revive_dt_node_interaction::EthereumNode;
|
|
|
|
pub mod driver;
|
|
|
|
/// One platform can be tested differentially against another.
|
|
///
|
|
/// For this we need a blockchain node implementation and a compiler.
|
|
pub trait Platform {
|
|
type Blockchain: EthereumNode + Node + ResolverApi;
|
|
type Compiler: SolidityCompiler;
|
|
|
|
/// Returns the matching [TestingPlatform] of the [revive_dt_config::Arguments].
|
|
fn config_id() -> TestingPlatform;
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct Geth;
|
|
|
|
impl Platform for Geth {
|
|
type Blockchain = geth::Instance;
|
|
type Compiler = solc::Solc;
|
|
|
|
fn config_id() -> TestingPlatform {
|
|
TestingPlatform::Geth
|
|
}
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub struct Kitchensink;
|
|
|
|
impl Platform for Kitchensink {
|
|
type Blockchain = KitchensinkNode;
|
|
type Compiler = revive_resolc::Resolc;
|
|
|
|
fn config_id() -> TestingPlatform {
|
|
TestingPlatform::Kitchensink
|
|
}
|
|
}
|