Add more identifiers to the platform

This commit is contained in:
Omar Abdulla
2025-09-17 06:25:35 +03:00
parent 01d8042841
commit 1a25c8e0ab
6 changed files with 146 additions and 33 deletions
Generated
+2
View File
@@ -4468,10 +4468,12 @@ name = "revive-dt-common"
version = "0.1.0"
dependencies = [
"anyhow",
"clap",
"moka",
"once_cell",
"semver 1.0.26",
"serde",
"strum",
"tokio",
]
+2
View File
@@ -10,10 +10,12 @@ rust-version.workspace = true
[dependencies]
anyhow = { workspace = true }
clap = { workspace = true }
moka = { workspace = true, features = ["sync"] }
once_cell = { workspace = true }
semver = { workspace = true }
serde = { workspace = true }
strum = { workspace = true }
tokio = { workspace = true, default-features = false, features = ["time"] }
[lints]
+119
View File
@@ -0,0 +1,119 @@
use clap::ValueEnum;
use serde::{Deserialize, Serialize};
use strum::{AsRefStr, Display, EnumString, IntoStaticStr};
/// An enum of the platform identifiers of all of the platforms supported by this framework.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
Deserialize,
ValueEnum,
EnumString,
Display,
AsRefStr,
IntoStaticStr,
)]
#[serde(rename = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum PlatformIdentifier {
/// The Go-ethereum reference full node EVM implementation.
GethEvm,
/// The kitchensink node with the PolkaVM backend.
KitchensinkPolkaVM,
/// The kitchensink node with the REVM backend.
KitchensinkREVM,
/// The revive dev node with the PolkaVM backend.
ReviveDevNodePolkaVM,
/// The revive dev node with the REVM backend.
ReviveDevNodeREVM,
}
/// An enum of the platform identifiers of all of the platforms supported by this framework.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
Deserialize,
ValueEnum,
EnumString,
Display,
AsRefStr,
IntoStaticStr,
)]
#[serde(rename = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum CompilerIdentifier {
/// The solc compiler.
Solc,
/// The resolc compiler.
Resolc,
}
/// An enum representing the identifiers of the supported nodes.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
Deserialize,
ValueEnum,
EnumString,
Display,
AsRefStr,
IntoStaticStr,
)]
#[serde(rename = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum NodeIdentifier {
/// The go-ethereum node implementation.
Geth,
/// The Kitchensink node implementation.
Kitchensink,
/// The revive dev node implementation.
ReviveDevNode,
}
/// An enum representing the identifiers of the supported VMs.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
Deserialize,
ValueEnum,
EnumString,
Display,
AsRefStr,
IntoStaticStr,
)]
#[serde(rename = "kebab-case")]
#[strum(serialize_all = "kebab-case")]
pub enum VmIdentifier {
/// The ethereum virtual machine.
Evm,
/// Polkadot's PolaVM Risc-v based virtual machine.
PolkaVm,
}
+2
View File
@@ -1,5 +1,7 @@
mod identifiers;
mod mode;
mod version_or_requirement;
pub use identifiers::*;
pub use mode::*;
pub use version_or_requirement::*;
-31
View File
@@ -564,34 +564,3 @@ pub enum TestingPlatform {
/// The kitchensink runtime provides the PolkaVM (PVM) based node implementation.
Kitchensink,
}
/// An enum of the platform identifiers of all of the platforms supported by this framework.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
Serialize,
ValueEnum,
EnumString,
Display,
AsRefStr,
IntoStaticStr,
)]
#[strum(serialize_all = "kebab-case")]
pub enum PlatformIdentifier {
/// The Go-ethereum reference full node EVM implementation.
GethEvm,
/// The kitchensink node with the PolkaVM backend.
KitchensinkPolkaVM,
/// The kitchensink node with the REVM backend.
KitchensinkREVM,
/// The revive dev node with the PolkaVM backend.
ReviveDevNodePolkaVM,
/// The revive dev node with the REVM backend.
ReviveDevNodeREVM,
}
+21 -2
View File
@@ -3,7 +3,7 @@
//! This crate defines the testing configuration and
//! provides a helper utility to execute tests.
use revive_dt_common::types::VersionOrRequirement;
use revive_dt_common::types::*;
use revive_dt_compiler::{DynSolidityCompiler, SolidityCompiler, revive_resolc, solc};
use revive_dt_config::*;
use revive_dt_format::traits::ResolverApi;
@@ -49,9 +49,28 @@ impl Platform for Kitchensink {
/// A trait that describes the interface for the platforms that are supported by the tool.
pub trait DynPlatform {
/// Returns the identifier of this platform.
/// Returns the identifier of this platform. This is a combination of the node and the compiler
/// used.
fn platform_identifier(&self) -> PlatformIdentifier;
/// Returns a full identifier for the platform.
fn full_identifier(&self) -> (NodeIdentifier, VmIdentifier, CompilerIdentifier) {
(
self.node_identifier(),
self.vm_identifier(),
self.compiler_identifier(),
)
}
/// Returns the identifier of the node used.
fn node_identifier(&self) -> NodeIdentifier;
/// Returns the identifier of the vm used.
fn vm_identifier(&self) -> VmIdentifier;
/// Returns the identifier of the compiler used.
fn compiler_identifier(&self) -> CompilerIdentifier;
/// Creates a new node for the platform by spawning a new thread, creating the node object,
/// initializing it, spawning it, and waiting for it to start up.
fn new_node(