mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-07-24 15:05:40 +00:00
Add all of the platforms that we support
This commit is contained in:
@@ -28,11 +28,11 @@ pub enum PlatformIdentifier {
|
|||||||
/// The kitchensink node with the PolkaVM backend with the resolc compiler.
|
/// The kitchensink node with the PolkaVM backend with the resolc compiler.
|
||||||
KitchensinkPolkavmResolc,
|
KitchensinkPolkavmResolc,
|
||||||
/// The kitchensink node with the REVM backend with the solc compiler.
|
/// The kitchensink node with the REVM backend with the solc compiler.
|
||||||
KitchensinkREVMSolc,
|
KitchensinkRevmSolc,
|
||||||
/// The revive dev node with the PolkaVM backend with the resolc compiler.
|
/// The revive dev node with the PolkaVM backend with the resolc compiler.
|
||||||
ReviveDevNodePolkavmResolc,
|
ReviveDevNodePolkavmResolc,
|
||||||
/// The revive dev node with the REVM backend with the solc compiler.
|
/// The revive dev node with the REVM backend with the solc compiler.
|
||||||
ReviveDevNodeREVMSolc,
|
ReviveDevNodeRevmSolc,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum of the platform identifiers of all of the platforms supported by this framework.
|
/// An enum of the platform identifiers of all of the platforms supported by this framework.
|
||||||
|
|||||||
+262
-1
@@ -12,7 +12,8 @@ use alloy::genesis::Genesis;
|
|||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
use revive_dt_common::types::*;
|
use revive_dt_common::types::*;
|
||||||
use revive_dt_compiler::{
|
use revive_dt_compiler::{
|
||||||
DynSolidityCompiler, SolidityCompiler, revive_resolc,
|
DynSolidityCompiler, SolidityCompiler,
|
||||||
|
revive_resolc::{self, Resolc},
|
||||||
solc::{self, Solc},
|
solc::{self, Solc},
|
||||||
};
|
};
|
||||||
use revive_dt_config::*;
|
use revive_dt_config::*;
|
||||||
@@ -174,6 +175,266 @@ impl DynPlatform for GethEvmPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct KitchensinkPolkavmResolc;
|
||||||
|
|
||||||
|
impl DynPlatform for KitchensinkPolkavmResolc {
|
||||||
|
fn platform_identifier(&self) -> PlatformIdentifier {
|
||||||
|
PlatformIdentifier::KitchensinkPolkavmResolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_identifier(&self) -> NodeIdentifier {
|
||||||
|
NodeIdentifier::Kitchensink
|
||||||
|
}
|
||||||
|
|
||||||
|
fn vm_identifier(&self) -> VmIdentifier {
|
||||||
|
VmIdentifier::Polkavm
|
||||||
|
}
|
||||||
|
|
||||||
|
fn compiler_identifier(&self) -> CompilerIdentifier {
|
||||||
|
CompilerIdentifier::Resolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_node(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ AsRef<ConcurrencyConfiguration>
|
||||||
|
+ AsRef<GenesisConfiguration>
|
||||||
|
+ AsRef<WalletConfiguration>
|
||||||
|
+ AsRef<GethConfiguration>
|
||||||
|
+ AsRef<KitchensinkConfiguration>
|
||||||
|
+ AsRef<ReviveDevNodeConfiguration>
|
||||||
|
+ AsRef<EthRpcConfiguration>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ Clone
|
||||||
|
+ 'static,
|
||||||
|
) -> anyhow::Result<JoinHandle<anyhow::Result<Box<dyn EthereumNode + Send + Sync>>>> {
|
||||||
|
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
||||||
|
let kitchensink_path = AsRef::<KitchensinkConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.clone();
|
||||||
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
|
Ok(thread::spawn(move || {
|
||||||
|
let node = SubstrateNode::new(
|
||||||
|
kitchensink_path,
|
||||||
|
SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
let node = spawn_node(node, genesis)?;
|
||||||
|
Ok(Box::new(node) as Box<_>)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_compiler<'a>(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<SolcConfiguration>
|
||||||
|
+ AsRef<ResolcConfiguration>
|
||||||
|
+ AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ 'a,
|
||||||
|
version: impl Into<Option<VersionOrRequirement>> + 'a,
|
||||||
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn DynSolidityCompiler>>> + 'a>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let compiler = Resolc::new(context, version).await;
|
||||||
|
compiler.map(|compiler| Box::new(compiler) as Box<dyn DynSolidityCompiler>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct KitchensinkRevmSolc;
|
||||||
|
|
||||||
|
impl DynPlatform for KitchensinkRevmSolc {
|
||||||
|
fn platform_identifier(&self) -> PlatformIdentifier {
|
||||||
|
PlatformIdentifier::KitchensinkRevmSolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_identifier(&self) -> NodeIdentifier {
|
||||||
|
NodeIdentifier::Kitchensink
|
||||||
|
}
|
||||||
|
|
||||||
|
fn vm_identifier(&self) -> VmIdentifier {
|
||||||
|
VmIdentifier::Evm
|
||||||
|
}
|
||||||
|
|
||||||
|
fn compiler_identifier(&self) -> CompilerIdentifier {
|
||||||
|
CompilerIdentifier::Solc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_node(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ AsRef<ConcurrencyConfiguration>
|
||||||
|
+ AsRef<GenesisConfiguration>
|
||||||
|
+ AsRef<WalletConfiguration>
|
||||||
|
+ AsRef<GethConfiguration>
|
||||||
|
+ AsRef<KitchensinkConfiguration>
|
||||||
|
+ AsRef<ReviveDevNodeConfiguration>
|
||||||
|
+ AsRef<EthRpcConfiguration>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ Clone
|
||||||
|
+ 'static,
|
||||||
|
) -> anyhow::Result<JoinHandle<anyhow::Result<Box<dyn EthereumNode + Send + Sync>>>> {
|
||||||
|
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
||||||
|
let kitchensink_path = AsRef::<KitchensinkConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.clone();
|
||||||
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
|
Ok(thread::spawn(move || {
|
||||||
|
let node = SubstrateNode::new(
|
||||||
|
kitchensink_path,
|
||||||
|
SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
let node = spawn_node(node, genesis)?;
|
||||||
|
Ok(Box::new(node) as Box<_>)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_compiler<'a>(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<SolcConfiguration>
|
||||||
|
+ AsRef<ResolcConfiguration>
|
||||||
|
+ AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ 'a,
|
||||||
|
version: impl Into<Option<VersionOrRequirement>> + 'a,
|
||||||
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn DynSolidityCompiler>>> + 'a>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let compiler = Solc::new(context, version).await;
|
||||||
|
compiler.map(|compiler| Box::new(compiler) as Box<dyn DynSolidityCompiler>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ReviveDevNodePolkavmResolc;
|
||||||
|
|
||||||
|
impl DynPlatform for ReviveDevNodePolkavmResolc {
|
||||||
|
fn platform_identifier(&self) -> PlatformIdentifier {
|
||||||
|
PlatformIdentifier::ReviveDevNodePolkavmResolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_identifier(&self) -> NodeIdentifier {
|
||||||
|
NodeIdentifier::ReviveDevNode
|
||||||
|
}
|
||||||
|
|
||||||
|
fn vm_identifier(&self) -> VmIdentifier {
|
||||||
|
VmIdentifier::Polkavm
|
||||||
|
}
|
||||||
|
|
||||||
|
fn compiler_identifier(&self) -> CompilerIdentifier {
|
||||||
|
CompilerIdentifier::Resolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_node(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ AsRef<ConcurrencyConfiguration>
|
||||||
|
+ AsRef<GenesisConfiguration>
|
||||||
|
+ AsRef<WalletConfiguration>
|
||||||
|
+ AsRef<GethConfiguration>
|
||||||
|
+ AsRef<ReviveDevNodeConfiguration>
|
||||||
|
+ AsRef<ReviveDevNodeConfiguration>
|
||||||
|
+ AsRef<EthRpcConfiguration>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ Clone
|
||||||
|
+ 'static,
|
||||||
|
) -> anyhow::Result<JoinHandle<anyhow::Result<Box<dyn EthereumNode + Send + Sync>>>> {
|
||||||
|
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
||||||
|
let revive_dev_node_path = AsRef::<ReviveDevNodeConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.clone();
|
||||||
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
|
Ok(thread::spawn(move || {
|
||||||
|
let node = SubstrateNode::new(
|
||||||
|
revive_dev_node_path,
|
||||||
|
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
let node = spawn_node(node, genesis)?;
|
||||||
|
Ok(Box::new(node) as Box<_>)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_compiler<'a>(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<SolcConfiguration>
|
||||||
|
+ AsRef<ResolcConfiguration>
|
||||||
|
+ AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ 'a,
|
||||||
|
version: impl Into<Option<VersionOrRequirement>> + 'a,
|
||||||
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn DynSolidityCompiler>>> + 'a>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let compiler = Resolc::new(context, version).await;
|
||||||
|
compiler.map(|compiler| Box::new(compiler) as Box<dyn DynSolidityCompiler>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ReviveDevNodeRevmSolc;
|
||||||
|
|
||||||
|
impl DynPlatform for ReviveDevNodeRevmSolc {
|
||||||
|
fn platform_identifier(&self) -> PlatformIdentifier {
|
||||||
|
PlatformIdentifier::ReviveDevNodeRevmSolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_identifier(&self) -> NodeIdentifier {
|
||||||
|
NodeIdentifier::ReviveDevNode
|
||||||
|
}
|
||||||
|
|
||||||
|
fn vm_identifier(&self) -> VmIdentifier {
|
||||||
|
VmIdentifier::Evm
|
||||||
|
}
|
||||||
|
|
||||||
|
fn compiler_identifier(&self) -> CompilerIdentifier {
|
||||||
|
CompilerIdentifier::Solc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_node(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ AsRef<ConcurrencyConfiguration>
|
||||||
|
+ AsRef<GenesisConfiguration>
|
||||||
|
+ AsRef<WalletConfiguration>
|
||||||
|
+ AsRef<GethConfiguration>
|
||||||
|
+ AsRef<ReviveDevNodeConfiguration>
|
||||||
|
+ AsRef<ReviveDevNodeConfiguration>
|
||||||
|
+ AsRef<EthRpcConfiguration>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ Clone
|
||||||
|
+ 'static,
|
||||||
|
) -> anyhow::Result<JoinHandle<anyhow::Result<Box<dyn EthereumNode + Send + Sync>>>> {
|
||||||
|
let genesis_configuration = AsRef::<GenesisConfiguration>::as_ref(&context);
|
||||||
|
let revive_dev_node_path = AsRef::<ReviveDevNodeConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.clone();
|
||||||
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
|
Ok(thread::spawn(move || {
|
||||||
|
let node = SubstrateNode::new(
|
||||||
|
revive_dev_node_path,
|
||||||
|
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
let node = spawn_node(node, genesis)?;
|
||||||
|
Ok(Box::new(node) as Box<_>)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_compiler<'a>(
|
||||||
|
&self,
|
||||||
|
context: impl AsRef<SolcConfiguration>
|
||||||
|
+ AsRef<ResolcConfiguration>
|
||||||
|
+ AsRef<WorkingDirectoryConfiguration>
|
||||||
|
+ 'a,
|
||||||
|
version: impl Into<Option<VersionOrRequirement>> + 'a,
|
||||||
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn DynSolidityCompiler>>> + 'a>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let compiler = Solc::new(context, version).await;
|
||||||
|
compiler.map(|compiler| Box::new(compiler) as Box<dyn DynSolidityCompiler>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn spawn_node<T: Node + EthereumNode + Send + Sync>(
|
fn spawn_node<T: Node + EthereumNode + Send + Sync>(
|
||||||
mut node: T,
|
mut node: T,
|
||||||
genesis: Genesis,
|
genesis: Genesis,
|
||||||
|
|||||||
Reference in New Issue
Block a user