mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-10 20:51:01 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e58cdfa7f | |||
| d2af7f6c2b | |||
| 3dd4299bf1 | |||
| 07e7a62fd3 | |||
| 65e129654d | |||
| b3c8b0368c |
+12
-19
@@ -51,22 +51,22 @@ jobs:
|
|||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/bin/revive-dev-node
|
~/.cargo/bin/substrate-node
|
||||||
~/.cargo/bin/eth-rpc
|
~/.cargo/bin/eth-rpc
|
||||||
key: polkadot-binaries-${{ matrix.os }}-${{ hashFiles('polkadot-sdk/.git') }}-with-dev-node
|
key: polkadot-binaries-${{ matrix.os }}-${{ hashFiles('polkadot-sdk/.git') }}
|
||||||
|
|
||||||
- name: Build revive-dev-node
|
- name: Build substrate-node
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
cd polkadot-sdk
|
cd polkadot-sdk
|
||||||
cargo install --locked --force --profile=production --path substrate/frame/revive/dev-node/node --bin revive-dev-node
|
cargo install --locked --force --profile=production --path substrate/bin/node/cli --bin substrate-node --features cli
|
||||||
|
|
||||||
- name: Build eth-rpc
|
- name: Build eth-rpc
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
cd polkadot-sdk
|
cd polkadot-sdk
|
||||||
cargo install --path substrate/frame/revive/rpc --bin eth-rpc
|
cargo install --path substrate/frame/revive/rpc --bin eth-rpc
|
||||||
|
|
||||||
- name: Cache downloaded Polkadot binaries
|
- name: Cache downloaded Polkadot binaries
|
||||||
id: cache-polkadot
|
id: cache-polkadot
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@@ -109,16 +109,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Restore binaries from cache
|
- name: Restore binaries from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/bin/revive-dev-node
|
~/.cargo/bin/substrate-node
|
||||||
~/.cargo/bin/eth-rpc
|
~/.cargo/bin/eth-rpc
|
||||||
key: polkadot-binaries-${{ matrix.os }}-${{ hashFiles('polkadot-sdk/.git') }}-with-dev-node
|
key: polkadot-binaries-${{ matrix.os }}-${{ hashFiles('polkadot-sdk/.git') }}
|
||||||
|
|
||||||
- name: Restore downloaded Polkadot binaries from cache
|
- name: Restore downloaded Polkadot binaries from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@@ -204,13 +202,8 @@ jobs:
|
|||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install kurtosis-cli
|
sudo apt install kurtosis-cli
|
||||||
|
|
||||||
- name: Install cargo-machete
|
|
||||||
uses: clechasseur/rs-cargo@v2
|
|
||||||
with:
|
|
||||||
command: install
|
|
||||||
args: cargo-machete@0.7.0
|
|
||||||
- name: Machete
|
- name: Machete
|
||||||
run: cargo machete crates
|
uses: bnjbvr/cargo-machete@v0.7.1
|
||||||
|
|
||||||
- name: Format
|
- name: Format
|
||||||
run: make format
|
run: make format
|
||||||
@@ -218,8 +211,8 @@ jobs:
|
|||||||
- name: Clippy
|
- name: Clippy
|
||||||
run: make clippy
|
run: make clippy
|
||||||
|
|
||||||
- name: Check revive-dev-node version
|
- name: Check substrate-node version
|
||||||
run: revive-dev-node --version
|
run: substrate-node --version
|
||||||
|
|
||||||
- name: Check eth-rpc version
|
- name: Check eth-rpc version
|
||||||
run: eth-rpc --version
|
run: eth-rpc --version
|
||||||
@@ -229,13 +222,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Check polkadot version
|
- name: Check polkadot version
|
||||||
run: polkadot --version
|
run: polkadot --version
|
||||||
|
|
||||||
- name: Check polkadot-parachain version
|
- name: Check polkadot-parachain version
|
||||||
run: polkadot-parachain --version
|
run: polkadot-parachain --version
|
||||||
|
|
||||||
- name: Check polkadot-execute-worker version
|
- name: Check polkadot-execute-worker version
|
||||||
run: polkadot-execute-worker --version
|
run: polkadot-execute-worker --version
|
||||||
|
|
||||||
- name: Check polkadot-prepare-worker version
|
- name: Check polkadot-prepare-worker version
|
||||||
run: polkadot-prepare-worker --version
|
run: polkadot-prepare-worker --version
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
This project compiles and executes declarative smart-contract tests against multiple platforms, then compares behavior (status, return data, events, and state diffs). Today it supports:
|
This project compiles and executes declarative smart-contract tests against multiple platforms, then compares behavior (status, return data, events, and state diffs). Today it supports:
|
||||||
|
|
||||||
- Geth (EVM reference implementation)
|
- Geth (EVM reference implementation)
|
||||||
- Revive Dev Node (Substrate-based PolkaVM + `eth-rpc` proxy)
|
- Revive Kitchensink (Substrate-based PolkaVM + `eth-rpc` proxy)
|
||||||
|
|
||||||
Use it to:
|
Use it to:
|
||||||
|
|
||||||
@@ -39,9 +39,9 @@ This repository contains none of the tests and only contains the testing framewo
|
|||||||
This section describes the required dependencies that this framework requires to run. Compiling this framework is pretty straightforward and no additional dependencies beyond what's specified in the `Cargo.toml` file should be required.
|
This section describes the required dependencies that this framework requires to run. Compiling this framework is pretty straightforward and no additional dependencies beyond what's specified in the `Cargo.toml` file should be required.
|
||||||
|
|
||||||
- Stable Rust
|
- Stable Rust
|
||||||
- Geth - When doing differential testing against the PVM we submit transactions to a Geth node and to Revive Dev Node to compare them.
|
- Geth - When doing differential testing against the PVM we submit transactions to a Geth node and to Kitchensink to compare them.
|
||||||
- Revive Dev Node - When doing differential testing against the PVM we submit transactions to a Geth node and to Revive Dev Node to compare them.
|
- Kitchensink - When doing differential testing against the PVM we submit transactions to a Geth node and to Kitchensink to compare them.
|
||||||
- ETH-RPC - All communication with Revive Dev Node is done through the ETH RPC.
|
- ETH-RPC - All communication with Kitchensink is done through the ETH RPC.
|
||||||
- Solc - This is actually a transitive dependency, while this tool doesn't require solc as it downloads the versions that it requires, resolc requires that Solc is installed and available in the path.
|
- Solc - This is actually a transitive dependency, while this tool doesn't require solc as it downloads the versions that it requires, resolc requires that Solc is installed and available in the path.
|
||||||
- Resolc - This is required to compile the contracts to PolkaVM bytecode.
|
- Resolc - This is required to compile the contracts to PolkaVM bytecode.
|
||||||
- Kurtosis - The Kurtosis CLI tool is required for the production Ethereum mainnet-like node configuration with Geth as the execution layer and lighthouse as the consensus layer. Kurtosis also requires docker to be installed since it runs everything inside of docker containers.
|
- Kurtosis - The Kurtosis CLI tool is required for the production Ethereum mainnet-like node configuration with Geth as the execution layer and lighthouse as the consensus layer. Kurtosis also requires docker to be installed since it runs everything inside of docker containers.
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ pub enum PlatformIdentifier {
|
|||||||
GethEvmSolc,
|
GethEvmSolc,
|
||||||
/// The Lighthouse Go-ethereum reference full node EVM implementation with the solc compiler.
|
/// The Lighthouse Go-ethereum reference full node EVM implementation with the solc compiler.
|
||||||
LighthouseGethEvmSolc,
|
LighthouseGethEvmSolc,
|
||||||
|
/// The kitchensink node with the PolkaVM backend with the resolc compiler.
|
||||||
|
KitchensinkPolkavmResolc,
|
||||||
|
/// The kitchensink node with the REVM backend with the solc compiler.
|
||||||
|
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.
|
||||||
@@ -91,6 +95,8 @@ pub enum NodeIdentifier {
|
|||||||
Geth,
|
Geth,
|
||||||
/// The go-ethereum node implementation.
|
/// The go-ethereum node implementation.
|
||||||
LighthouseGeth,
|
LighthouseGeth,
|
||||||
|
/// The Kitchensink node implementation.
|
||||||
|
Kitchensink,
|
||||||
/// The revive dev node implementation.
|
/// The revive dev node implementation.
|
||||||
ReviveDevNode,
|
ReviveDevNode,
|
||||||
/// A zombienet spawned nodes
|
/// A zombienet spawned nodes
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ use alloy::{
|
|||||||
primitives::{B256, FixedBytes, U256},
|
primitives::{B256, FixedBytes, U256},
|
||||||
signers::local::PrivateKeySigner,
|
signers::local::PrivateKeySigner,
|
||||||
};
|
};
|
||||||
use anyhow::Context as _;
|
|
||||||
use clap::{Parser, ValueEnum, ValueHint};
|
use clap::{Parser, ValueEnum, ValueHint};
|
||||||
use revive_dt_common::types::{ParsedTestSpecifier, PlatformIdentifier};
|
use revive_dt_common::types::{ParsedTestSpecifier, PlatformIdentifier};
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
@@ -132,6 +131,17 @@ impl AsRef<PolkadotParachainConfiguration> for Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<KitchensinkConfiguration> for Context {
|
||||||
|
fn as_ref(&self) -> &KitchensinkConfiguration {
|
||||||
|
match self {
|
||||||
|
Self::Test(context) => context.as_ref().as_ref(),
|
||||||
|
Self::Benchmark(context) => context.as_ref().as_ref(),
|
||||||
|
Self::ExportGenesis(context) => context.as_ref().as_ref(),
|
||||||
|
Self::ExportJsonSchema => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<ReviveDevNodeConfiguration> for Context {
|
impl AsRef<ReviveDevNodeConfiguration> for Context {
|
||||||
fn as_ref(&self) -> &ReviveDevNodeConfiguration {
|
fn as_ref(&self) -> &ReviveDevNodeConfiguration {
|
||||||
match self {
|
match self {
|
||||||
@@ -273,6 +283,10 @@ pub struct TestExecutionContext {
|
|||||||
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
|
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
|
||||||
pub lighthouse_configuration: KurtosisConfiguration,
|
pub lighthouse_configuration: KurtosisConfiguration,
|
||||||
|
|
||||||
|
/// Configuration parameters for the Kitchensink.
|
||||||
|
#[clap(flatten, next_help_heading = "Kitchensink Configuration")]
|
||||||
|
pub kitchensink_configuration: KitchensinkConfiguration,
|
||||||
|
|
||||||
/// Configuration parameters for the Revive Dev Node.
|
/// Configuration parameters for the Revive Dev Node.
|
||||||
#[clap(flatten, next_help_heading = "Revive Dev Node Configuration")]
|
#[clap(flatten, next_help_heading = "Revive Dev Node Configuration")]
|
||||||
pub revive_dev_node_configuration: ReviveDevNodeConfiguration,
|
pub revive_dev_node_configuration: ReviveDevNodeConfiguration,
|
||||||
@@ -395,6 +409,10 @@ pub struct BenchmarkingContext {
|
|||||||
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
|
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
|
||||||
pub lighthouse_configuration: KurtosisConfiguration,
|
pub lighthouse_configuration: KurtosisConfiguration,
|
||||||
|
|
||||||
|
/// Configuration parameters for the Kitchensink.
|
||||||
|
#[clap(flatten, next_help_heading = "Kitchensink Configuration")]
|
||||||
|
pub kitchensink_configuration: KitchensinkConfiguration,
|
||||||
|
|
||||||
/// Configuration parameters for the Polkadot Parachain.
|
/// Configuration parameters for the Polkadot Parachain.
|
||||||
#[clap(flatten, next_help_heading = "Polkadot Parachain Configuration")]
|
#[clap(flatten, next_help_heading = "Polkadot Parachain Configuration")]
|
||||||
pub polkadot_parachain_configuration: PolkadotParachainConfiguration,
|
pub polkadot_parachain_configuration: PolkadotParachainConfiguration,
|
||||||
@@ -473,6 +491,10 @@ pub struct ExportGenesisContext {
|
|||||||
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
|
#[clap(flatten, next_help_heading = "Lighthouse Configuration")]
|
||||||
pub lighthouse_configuration: KurtosisConfiguration,
|
pub lighthouse_configuration: KurtosisConfiguration,
|
||||||
|
|
||||||
|
/// Configuration parameters for the Kitchensink.
|
||||||
|
#[clap(flatten, next_help_heading = "Kitchensink Configuration")]
|
||||||
|
pub kitchensink_configuration: KitchensinkConfiguration,
|
||||||
|
|
||||||
/// Configuration parameters for the Polkadot Parachain.
|
/// Configuration parameters for the Polkadot Parachain.
|
||||||
#[clap(flatten, next_help_heading = "Polkadot Parachain Configuration")]
|
#[clap(flatten, next_help_heading = "Polkadot Parachain Configuration")]
|
||||||
pub polkadot_parachain_configuration: PolkadotParachainConfiguration,
|
pub polkadot_parachain_configuration: PolkadotParachainConfiguration,
|
||||||
@@ -534,6 +556,12 @@ impl AsRef<KurtosisConfiguration> for TestExecutionContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<KitchensinkConfiguration> for TestExecutionContext {
|
||||||
|
fn as_ref(&self) -> &KitchensinkConfiguration {
|
||||||
|
&self.kitchensink_configuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<ReviveDevNodeConfiguration> for TestExecutionContext {
|
impl AsRef<ReviveDevNodeConfiguration> for TestExecutionContext {
|
||||||
fn as_ref(&self) -> &ReviveDevNodeConfiguration {
|
fn as_ref(&self) -> &ReviveDevNodeConfiguration {
|
||||||
&self.revive_dev_node_configuration
|
&self.revive_dev_node_configuration
|
||||||
@@ -630,6 +658,12 @@ impl AsRef<PolkadotParachainConfiguration> for BenchmarkingContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<KitchensinkConfiguration> for BenchmarkingContext {
|
||||||
|
fn as_ref(&self) -> &KitchensinkConfiguration {
|
||||||
|
&self.kitchensink_configuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<ReviveDevNodeConfiguration> for BenchmarkingContext {
|
impl AsRef<ReviveDevNodeConfiguration> for BenchmarkingContext {
|
||||||
fn as_ref(&self) -> &ReviveDevNodeConfiguration {
|
fn as_ref(&self) -> &ReviveDevNodeConfiguration {
|
||||||
&self.revive_dev_node_configuration
|
&self.revive_dev_node_configuration
|
||||||
@@ -684,6 +718,12 @@ impl AsRef<KurtosisConfiguration> for ExportGenesisContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<KitchensinkConfiguration> for ExportGenesisContext {
|
||||||
|
fn as_ref(&self) -> &KitchensinkConfiguration {
|
||||||
|
&self.kitchensink_configuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<PolkadotParachainConfiguration> for ExportGenesisContext {
|
impl AsRef<PolkadotParachainConfiguration> for ExportGenesisContext {
|
||||||
fn as_ref(&self) -> &PolkadotParachainConfiguration {
|
fn as_ref(&self) -> &PolkadotParachainConfiguration {
|
||||||
&self.polkadot_parachain_configuration
|
&self.polkadot_parachain_configuration
|
||||||
@@ -802,6 +842,30 @@ pub struct KurtosisConfiguration {
|
|||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A set of configuration parameters for Kitchensink.
|
||||||
|
#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
|
||||||
|
pub struct KitchensinkConfiguration {
|
||||||
|
/// Specifies the path of the kitchensink node to be used by the tool.
|
||||||
|
///
|
||||||
|
/// If this is not specified, then the tool assumes that it should use the kitchensink binary
|
||||||
|
/// that's provided in the user's $PATH.
|
||||||
|
#[clap(
|
||||||
|
id = "kitchensink.path",
|
||||||
|
long = "kitchensink.path",
|
||||||
|
default_value = "substrate-node"
|
||||||
|
)]
|
||||||
|
pub path: PathBuf,
|
||||||
|
|
||||||
|
/// The amount of time to wait upon startup before considering that the node timed out.
|
||||||
|
#[clap(
|
||||||
|
id = "kitchensink.start-timeout-ms",
|
||||||
|
long = "kitchensink.start-timeout-ms",
|
||||||
|
default_value = "30000",
|
||||||
|
value_parser = parse_duration
|
||||||
|
)]
|
||||||
|
pub start_timeout_ms: Duration,
|
||||||
|
}
|
||||||
|
|
||||||
/// A set of configuration parameters for the revive dev node.
|
/// A set of configuration parameters for the revive dev node.
|
||||||
#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
|
||||||
pub struct ReviveDevNodeConfiguration {
|
pub struct ReviveDevNodeConfiguration {
|
||||||
@@ -1080,10 +1144,7 @@ impl FromStr for WorkingDirectoryConfiguration {
|
|||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
match s {
|
match s {
|
||||||
"" => Ok(Default::default()),
|
"" => Ok(Default::default()),
|
||||||
_ => PathBuf::from(s)
|
_ => Ok(Self::Path(PathBuf::from(s))),
|
||||||
.canonicalize()
|
|
||||||
.context("Failed to canonicalize the working directory path")
|
|
||||||
.map(Self::Path),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1100,6 +1161,35 @@ fn parse_duration(s: &str) -> anyhow::Result<Duration> {
|
|||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The Solidity compatible node implementation.
|
||||||
|
///
|
||||||
|
/// This describes the solutions to be tested against on a high level.
|
||||||
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
PartialOrd,
|
||||||
|
Ord,
|
||||||
|
Hash,
|
||||||
|
Serialize,
|
||||||
|
ValueEnum,
|
||||||
|
EnumString,
|
||||||
|
Display,
|
||||||
|
AsRefStr,
|
||||||
|
IntoStaticStr,
|
||||||
|
)]
|
||||||
|
#[strum(serialize_all = "kebab-case")]
|
||||||
|
pub enum TestingPlatform {
|
||||||
|
/// The go-ethereum reference full node EVM implementation.
|
||||||
|
Geth,
|
||||||
|
/// The kitchensink runtime provides the PolkaVM (PVM) based node implementation.
|
||||||
|
Kitchensink,
|
||||||
|
/// A polkadot/Substrate based network
|
||||||
|
Zombienet,
|
||||||
|
}
|
||||||
|
|
||||||
/// The output format to use for the test execution output.
|
/// The output format to use for the test execution output.
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone,
|
||||||
|
|||||||
@@ -353,8 +353,7 @@ where
|
|||||||
.execute_account_allocation(step_path, step.as_ref())
|
.execute_account_allocation(step_path, step.as_ref())
|
||||||
.await
|
.await
|
||||||
.context("Account Allocation Step Failed"),
|
.context("Account Allocation Step Failed"),
|
||||||
}
|
}?;
|
||||||
.context(format!("Failure on step {step_path}"))?;
|
|
||||||
self.steps_executed += steps_executed;
|
self.steps_executed += steps_executed;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -598,20 +597,15 @@ where
|
|||||||
let expected = !assertion.exception;
|
let expected = !assertion.exception;
|
||||||
let actual = receipt.status();
|
let actual = receipt.status();
|
||||||
if actual != expected {
|
if actual != expected {
|
||||||
let revert_reason = tracing_result
|
|
||||||
.revert_reason
|
|
||||||
.as_ref()
|
|
||||||
.or(tracing_result.error.as_ref());
|
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
expected,
|
expected,
|
||||||
actual,
|
actual,
|
||||||
?receipt,
|
?receipt,
|
||||||
?tracing_result,
|
?tracing_result,
|
||||||
?revert_reason,
|
|
||||||
"Transaction status assertion failed"
|
"Transaction status assertion failed"
|
||||||
);
|
);
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"Transaction status assertion failed - Expected {expected} but got {actual}. Revert reason: {revert_reason:?}",
|
"Transaction status assertion failed - Expected {expected} but got {actual}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+142
-14
@@ -172,6 +172,134 @@ impl Platform for LighthouseGethEvmSolcPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
||||||
|
pub struct KitchensinkPolkavmResolcPlatform;
|
||||||
|
|
||||||
|
impl Platform for KitchensinkPolkavmResolcPlatform {
|
||||||
|
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: Context,
|
||||||
|
) -> 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,
|
||||||
|
None,
|
||||||
|
context,
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
let node = spawn_node(node, genesis)?;
|
||||||
|
Ok(Box::new(node) as Box<_>)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_compiler(
|
||||||
|
&self,
|
||||||
|
context: Context,
|
||||||
|
version: Option<VersionOrRequirement>,
|
||||||
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn SolidityCompiler>>>>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let compiler = Resolc::new(context, version).await;
|
||||||
|
compiler.map(|compiler| Box::new(compiler) as Box<dyn SolidityCompiler>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn export_genesis(&self, context: Context) -> anyhow::Result<serde_json::Value> {
|
||||||
|
let kitchensink_path = AsRef::<KitchensinkConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.as_path();
|
||||||
|
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
||||||
|
let export_chainspec_command = SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND;
|
||||||
|
|
||||||
|
SubstrateNode::node_genesis(kitchensink_path, export_chainspec_command, &wallet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
||||||
|
pub struct KitchensinkRevmSolcPlatform;
|
||||||
|
|
||||||
|
impl Platform for KitchensinkRevmSolcPlatform {
|
||||||
|
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: Context,
|
||||||
|
) -> 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,
|
||||||
|
None,
|
||||||
|
context,
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
let node = spawn_node(node, genesis)?;
|
||||||
|
Ok(Box::new(node) as Box<_>)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_compiler(
|
||||||
|
&self,
|
||||||
|
context: Context,
|
||||||
|
version: Option<VersionOrRequirement>,
|
||||||
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn SolidityCompiler>>>>> {
|
||||||
|
Box::pin(async move {
|
||||||
|
let compiler = Solc::new(context, version).await;
|
||||||
|
compiler.map(|compiler| Box::new(compiler) as Box<dyn SolidityCompiler>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn export_genesis(&self, context: Context) -> anyhow::Result<serde_json::Value> {
|
||||||
|
let kitchensink_path = AsRef::<KitchensinkConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.as_path();
|
||||||
|
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
||||||
|
let export_chainspec_command = SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND;
|
||||||
|
|
||||||
|
SubstrateNode::node_genesis(kitchensink_path, export_chainspec_command, &wallet)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
||||||
pub struct ReviveDevNodePolkavmResolcPlatform;
|
pub struct ReviveDevNodePolkavmResolcPlatform;
|
||||||
|
|
||||||
@@ -234,15 +362,9 @@ impl Platform for ReviveDevNodePolkavmResolcPlatform {
|
|||||||
.path
|
.path
|
||||||
.as_path();
|
.as_path();
|
||||||
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
||||||
let working_directory = AsRef::<WorkingDirectoryConfiguration>::as_ref(&context).as_path();
|
|
||||||
let export_chainspec_command = SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND;
|
let export_chainspec_command = SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND;
|
||||||
|
|
||||||
SubstrateNode::node_genesis(
|
SubstrateNode::node_genesis(revive_dev_node_path, export_chainspec_command, &wallet)
|
||||||
revive_dev_node_path,
|
|
||||||
export_chainspec_command,
|
|
||||||
&wallet,
|
|
||||||
working_directory,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,15 +430,9 @@ impl Platform for ReviveDevNodeRevmSolcPlatform {
|
|||||||
.path
|
.path
|
||||||
.as_path();
|
.as_path();
|
||||||
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
||||||
let working_directory = AsRef::<WorkingDirectoryConfiguration>::as_ref(&context).as_path();
|
|
||||||
let export_chainspec_command = SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND;
|
let export_chainspec_command = SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND;
|
||||||
|
|
||||||
SubstrateNode::node_genesis(
|
SubstrateNode::node_genesis(revive_dev_node_path, export_chainspec_command, &wallet)
|
||||||
revive_dev_node_path,
|
|
||||||
export_chainspec_command,
|
|
||||||
&wallet,
|
|
||||||
working_directory,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,6 +557,12 @@ impl From<PlatformIdentifier> for Box<dyn Platform> {
|
|||||||
PlatformIdentifier::LighthouseGethEvmSolc => {
|
PlatformIdentifier::LighthouseGethEvmSolc => {
|
||||||
Box::new(LighthouseGethEvmSolcPlatform) as Box<_>
|
Box::new(LighthouseGethEvmSolcPlatform) as Box<_>
|
||||||
}
|
}
|
||||||
|
PlatformIdentifier::KitchensinkPolkavmResolc => {
|
||||||
|
Box::new(KitchensinkPolkavmResolcPlatform) as Box<_>
|
||||||
|
}
|
||||||
|
PlatformIdentifier::KitchensinkRevmSolc => {
|
||||||
|
Box::new(KitchensinkRevmSolcPlatform) as Box<_>
|
||||||
|
}
|
||||||
PlatformIdentifier::ReviveDevNodePolkavmResolc => {
|
PlatformIdentifier::ReviveDevNodePolkavmResolc => {
|
||||||
Box::new(ReviveDevNodePolkavmResolcPlatform) as Box<_>
|
Box::new(ReviveDevNodePolkavmResolcPlatform) as Box<_>
|
||||||
}
|
}
|
||||||
@@ -462,6 +584,12 @@ impl From<PlatformIdentifier> for &dyn Platform {
|
|||||||
PlatformIdentifier::LighthouseGethEvmSolc => {
|
PlatformIdentifier::LighthouseGethEvmSolc => {
|
||||||
&LighthouseGethEvmSolcPlatform as &dyn Platform
|
&LighthouseGethEvmSolcPlatform as &dyn Platform
|
||||||
}
|
}
|
||||||
|
PlatformIdentifier::KitchensinkPolkavmResolc => {
|
||||||
|
&KitchensinkPolkavmResolcPlatform as &dyn Platform
|
||||||
|
}
|
||||||
|
PlatformIdentifier::KitchensinkRevmSolc => {
|
||||||
|
&KitchensinkRevmSolcPlatform as &dyn Platform
|
||||||
|
}
|
||||||
PlatformIdentifier::ReviveDevNodePolkavmResolc => {
|
PlatformIdentifier::ReviveDevNodePolkavmResolc => {
|
||||||
&ReviveDevNodePolkavmResolcPlatform as &dyn Platform
|
&ReviveDevNodePolkavmResolcPlatform as &dyn Platform
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use std::{collections::HashMap, fmt::Display, str::FromStr};
|
use std::{collections::HashMap, fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use alloy::hex::ToHexExt;
|
|
||||||
use alloy::primitives::{FixedBytes, utils::parse_units};
|
use alloy::primitives::{FixedBytes, utils::parse_units};
|
||||||
use alloy::{
|
use alloy::{
|
||||||
eips::BlockNumberOrTag,
|
eips::BlockNumberOrTag,
|
||||||
@@ -687,8 +686,8 @@ impl Calldata {
|
|||||||
Calldata::Compound(items) => {
|
Calldata::Compound(items) => {
|
||||||
stream::iter(items.iter().zip(other.chunks(32)))
|
stream::iter(items.iter().zip(other.chunks(32)))
|
||||||
.map(|(this, other)| async move {
|
.map(|(this, other)| async move {
|
||||||
// The MatterLabs format supports wildcards and therefore we also need to
|
// The matterlabs format supports wildcards and therefore we
|
||||||
// support them.
|
// also need to support them.
|
||||||
if this.as_ref() == "*" {
|
if this.as_ref() == "*" {
|
||||||
return Ok::<_, anyhow::Error>(true);
|
return Ok::<_, anyhow::Error>(true);
|
||||||
}
|
}
|
||||||
@@ -769,14 +768,7 @@ impl CalldataItem {
|
|||||||
match stack.as_slice() {
|
match stack.as_slice() {
|
||||||
// Empty stack means that we got an empty compound calldata which we resolve to zero.
|
// Empty stack means that we got an empty compound calldata which we resolve to zero.
|
||||||
[] => Ok(U256::ZERO),
|
[] => Ok(U256::ZERO),
|
||||||
[CalldataToken::Item(item)] => {
|
[CalldataToken::Item(item)] => Ok(*item),
|
||||||
tracing::debug!(
|
|
||||||
original_item = ?self,
|
|
||||||
resolved_item = item.to_be_bytes::<32>().encode_hex(),
|
|
||||||
"Resolution Done"
|
|
||||||
);
|
|
||||||
Ok(*item)
|
|
||||||
}
|
|
||||||
_ => Err(anyhow::anyhow!(
|
_ => Err(anyhow::anyhow!(
|
||||||
"Invalid calldata arithmetic operation - Invalid stack"
|
"Invalid calldata arithmetic operation - Invalid stack"
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ impl SubstrateNode {
|
|||||||
const SUBSTRATE_LOG_ENV: &str = "error,evm=debug,sc_rpc_server=info,runtime::revive=debug";
|
const SUBSTRATE_LOG_ENV: &str = "error,evm=debug,sc_rpc_server=info,runtime::revive=debug";
|
||||||
const PROXY_LOG_ENV: &str = "info,eth-rpc=debug";
|
const PROXY_LOG_ENV: &str = "info,eth-rpc=debug";
|
||||||
|
|
||||||
|
pub const KITCHENSINK_EXPORT_CHAINSPEC_COMMAND: &str = "export-chain-spec";
|
||||||
pub const REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND: &str = "build-spec";
|
pub const REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND: &str = "build-spec";
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
@@ -160,7 +161,6 @@ impl SubstrateNode {
|
|||||||
&self.node_binary,
|
&self.node_binary,
|
||||||
&self.export_chainspec_command,
|
&self.export_chainspec_command,
|
||||||
&self.wallet,
|
&self.wallet,
|
||||||
self.base_directory.as_path(),
|
|
||||||
)
|
)
|
||||||
.context("Failed to prepare the chainspec command")?;
|
.context("Failed to prepare the chainspec command")?;
|
||||||
|
|
||||||
@@ -320,7 +320,6 @@ impl SubstrateNode {
|
|||||||
node_path: &Path,
|
node_path: &Path,
|
||||||
export_chainspec_command: &str,
|
export_chainspec_command: &str,
|
||||||
wallet: &EthereumWallet,
|
wallet: &EthereumWallet,
|
||||||
base_directory: impl AsRef<Path>,
|
|
||||||
) -> anyhow::Result<serde_json::Value> {
|
) -> anyhow::Result<serde_json::Value> {
|
||||||
trace!("Exporting the chainspec");
|
trace!("Exporting the chainspec");
|
||||||
let output = Command::new(node_path)
|
let output = Command::new(node_path)
|
||||||
@@ -328,14 +327,13 @@ impl SubstrateNode {
|
|||||||
.arg("--chain")
|
.arg("--chain")
|
||||||
.arg("dev")
|
.arg("dev")
|
||||||
.env_remove("RUST_LOG")
|
.env_remove("RUST_LOG")
|
||||||
.current_dir(base_directory)
|
|
||||||
.output()
|
.output()
|
||||||
.context("Failed to export the chain-spec")?;
|
.context("Failed to export the chain-spec")?;
|
||||||
|
|
||||||
trace!("Waiting for chainspec export");
|
trace!("Waiting for chainspec export");
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"substrate-node export-chain-spec failed: {}",
|
"Substrate-node export-chain-spec failed: {}",
|
||||||
String::from_utf8_lossy(&output.stderr)
|
String::from_utf8_lossy(&output.stderr)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -802,8 +800,8 @@ mod tests {
|
|||||||
|
|
||||||
let context = test_config();
|
let context = test_config();
|
||||||
let mut node = SubstrateNode::new(
|
let mut node = SubstrateNode::new(
|
||||||
context.revive_dev_node_configuration.path.clone(),
|
context.kitchensink_configuration.path.clone(),
|
||||||
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND,
|
||||||
None,
|
None,
|
||||||
&context,
|
&context,
|
||||||
&[],
|
&[],
|
||||||
@@ -825,7 +823,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[ignore = "Ignored since it takes a long time to run"]
|
|
||||||
async fn node_mines_simple_transfer_transaction_and_returns_receipt() {
|
async fn node_mines_simple_transfer_transaction_and_returns_receipt() {
|
||||||
// Arrange
|
// Arrange
|
||||||
let (context, node) = shared_state();
|
let (context, node) = shared_state();
|
||||||
@@ -842,14 +839,11 @@ mod tests {
|
|||||||
.value(U256::from(100_000_000_000_000u128));
|
.value(U256::from(100_000_000_000_000u128));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
let mut pending_transaction = provider
|
let receipt = provider.send_transaction(transaction).await;
|
||||||
.send_transaction(transaction)
|
|
||||||
.await
|
|
||||||
.expect("Submission failed");
|
|
||||||
pending_transaction.set_timeout(Some(Duration::from_secs(60)));
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
let _ = pending_transaction
|
let _ = receipt
|
||||||
|
.expect("Failed to send the transfer transaction")
|
||||||
.get_receipt()
|
.get_receipt()
|
||||||
.await
|
.await
|
||||||
.expect("Failed to get the receipt for the transfer");
|
.expect("Failed to get the receipt for the transfer");
|
||||||
@@ -873,8 +867,8 @@ mod tests {
|
|||||||
|
|
||||||
let context = test_config();
|
let context = test_config();
|
||||||
let mut dummy_node = SubstrateNode::new(
|
let mut dummy_node = SubstrateNode::new(
|
||||||
context.revive_dev_node_configuration.path.clone(),
|
context.kitchensink_configuration.path.clone(),
|
||||||
SubstrateNode::REVIVE_DEV_NODE_EXPORT_CHAINSPEC_COMMAND,
|
SubstrateNode::KITCHENSINK_EXPORT_CHAINSPEC_COMMAND,
|
||||||
None,
|
None,
|
||||||
&context,
|
&context,
|
||||||
&[],
|
&[],
|
||||||
@@ -967,7 +961,7 @@ mod tests {
|
|||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
version.starts_with("substrate-node"),
|
version.starts_with("substrate-node"),
|
||||||
"Expected substrate-node version string, got: {version}"
|
"Expected Substrate-node version string, got: {version}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ impl ZombienetNode {
|
|||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
"substrate-node export-chain-spec failed: {}",
|
"Substrate-node export-chain-spec failed: {}",
|
||||||
String::from_utf8_lossy(&output.stderr)
|
String::from_utf8_lossy(&output.stderr)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -858,7 +858,6 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[ignore = "Ignored for the time being"]
|
#[ignore = "Ignored for the time being"]
|
||||||
async fn test_transfer_transaction_should_return_receipt() {
|
async fn test_transfer_transaction_should_return_receipt() {
|
||||||
// Arrange
|
|
||||||
let (ctx, node) = new_node().await;
|
let (ctx, node) = new_node().await;
|
||||||
|
|
||||||
let provider = node.provider().await.expect("Failed to create provider");
|
let provider = node.provider().await.expect("Failed to create provider");
|
||||||
@@ -867,15 +866,9 @@ mod tests {
|
|||||||
.to(account_address)
|
.to(account_address)
|
||||||
.value(U256::from(100_000_000_000_000u128));
|
.value(U256::from(100_000_000_000_000u128));
|
||||||
|
|
||||||
// Act
|
let receipt = provider.send_transaction(transaction).await;
|
||||||
let mut pending_transaction = provider
|
let _ = receipt
|
||||||
.send_transaction(transaction)
|
.expect("Failed to send the transfer transaction")
|
||||||
.await
|
|
||||||
.expect("Submission failed");
|
|
||||||
pending_transaction.set_timeout(Some(Duration::from_secs(60)));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
let _ = pending_transaction
|
|
||||||
.get_receipt()
|
.get_receipt()
|
||||||
.await
|
.await
|
||||||
.expect("Failed to get the receipt for the transfer");
|
.expect("Failed to get the receipt for the transfer");
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ where
|
|||||||
) -> TransportResult<Self::Fillable> {
|
) -> TransportResult<Self::Fillable> {
|
||||||
match self.inner.prepare(provider, tx).await {
|
match self.inner.prepare(provider, tx).await {
|
||||||
Ok(fill) => Ok(Some(fill)),
|
Ok(fill) => Ok(Some(fill)),
|
||||||
Err(err) => {
|
Err(_) => Ok(None),
|
||||||
tracing::debug!(error = ?err, "Gas Provider Estimation Failed, using fallback");
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule polkadot-sdk updated: 6ffecaaab2...dc3d0e5ab7
+1
-1
Submodule resolc-compiler-tests updated: bb3b0c1319...ce77cb1166
+5
-2
@@ -22,6 +22,7 @@ POLKADOT_SDK_DIR="${1:-}"
|
|||||||
# Binary paths (default to names in $PATH)
|
# Binary paths (default to names in $PATH)
|
||||||
REVIVE_DEV_NODE_BIN="revive-dev-node"
|
REVIVE_DEV_NODE_BIN="revive-dev-node"
|
||||||
ETH_RPC_BIN="eth-rpc"
|
ETH_RPC_BIN="eth-rpc"
|
||||||
|
SUBSTRATE_NODE_BIN="substrate-node"
|
||||||
|
|
||||||
echo -e "${GREEN}=== Revive Differential Tests Quick Start ===${NC}"
|
echo -e "${GREEN}=== Revive Differential Tests Quick Start ===${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -49,13 +50,14 @@ if [ -n "$POLKADOT_SDK_DIR" ]; then
|
|||||||
|
|
||||||
REVIVE_DEV_NODE_BIN="$POLKADOT_SDK_DIR/target/release/revive-dev-node"
|
REVIVE_DEV_NODE_BIN="$POLKADOT_SDK_DIR/target/release/revive-dev-node"
|
||||||
ETH_RPC_BIN="$POLKADOT_SDK_DIR/target/release/eth-rpc"
|
ETH_RPC_BIN="$POLKADOT_SDK_DIR/target/release/eth-rpc"
|
||||||
|
SUBSTRATE_NODE_BIN="$POLKADOT_SDK_DIR/target/release/substrate-node"
|
||||||
|
|
||||||
if [ ! -x "$REVIVE_DEV_NODE_BIN" ] || [ ! -x "$ETH_RPC_BIN" ]; then
|
if [ ! -x "$REVIVE_DEV_NODE_BIN" ] || [ ! -x "$ETH_RPC_BIN" ] || [ ! -x "$SUBSTRATE_NODE_BIN" ]; then
|
||||||
echo -e "${YELLOW}Required binaries not found in release target. Building...${NC}"
|
echo -e "${YELLOW}Required binaries not found in release target. Building...${NC}"
|
||||||
(cd "$POLKADOT_SDK_DIR" && cargo build --release --package staging-node-cli --package pallet-revive-eth-rpc --package revive-dev-node)
|
(cd "$POLKADOT_SDK_DIR" && cargo build --release --package staging-node-cli --package pallet-revive-eth-rpc --package revive-dev-node)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for bin in "$REVIVE_DEV_NODE_BIN" "$ETH_RPC_BIN"; do
|
for bin in "$REVIVE_DEV_NODE_BIN" "$ETH_RPC_BIN" "$SUBSTRATE_NODE_BIN"; do
|
||||||
if [ ! -x "$bin" ]; then
|
if [ ! -x "$bin" ]; then
|
||||||
echo -e "${RED}Expected binary not found after build: $bin${NC}"
|
echo -e "${RED}Expected binary not found after build: $bin${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -82,6 +84,7 @@ RUST_LOG="info,alloy_pubsub::service=error" ./target/release/retester test \
|
|||||||
--concurrency.number-of-threads 5 \
|
--concurrency.number-of-threads 5 \
|
||||||
--concurrency.number-of-concurrent-tasks 500 \
|
--concurrency.number-of-concurrent-tasks 500 \
|
||||||
--wallet.additional-keys 100000 \
|
--wallet.additional-keys 100000 \
|
||||||
|
--kitchensink.path "$SUBSTRATE_NODE_BIN" \
|
||||||
--revive-dev-node.path "$REVIVE_DEV_NODE_BIN" \
|
--revive-dev-node.path "$REVIVE_DEV_NODE_BIN" \
|
||||||
--eth-rpc.path "$ETH_RPC_BIN" \
|
--eth-rpc.path "$ETH_RPC_BIN" \
|
||||||
> logs.log \
|
> logs.log \
|
||||||
|
|||||||
@@ -1,226 +0,0 @@
|
|||||||
"""
|
|
||||||
This script is used to turn the JSON report produced by the revive differential tests tool into an
|
|
||||||
easy to consume markdown document for the purpose of reporting this information in the Polkadot SDK
|
|
||||||
CI. The full models used in the JSON report can be found in the revive differential tests repo and
|
|
||||||
the models used in this script are just a partial reproduction of the full report models.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from typing import TypedDict, Literal, Union
|
|
||||||
|
|
||||||
import json, io
|
|
||||||
|
|
||||||
|
|
||||||
class Report(TypedDict):
|
|
||||||
context: "Context"
|
|
||||||
execution_information: dict[
|
|
||||||
"MetadataFilePathString",
|
|
||||||
dict["ModeString", dict["CaseIdxString", "CaseReport"]],
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class Context(TypedDict):
|
|
||||||
Test: "TestContext"
|
|
||||||
|
|
||||||
|
|
||||||
class TestContext(TypedDict):
|
|
||||||
corpus_configuration: "CorpusConfiguration"
|
|
||||||
|
|
||||||
|
|
||||||
class CorpusConfiguration(TypedDict):
|
|
||||||
test_specifiers: list["TestSpecifier"]
|
|
||||||
|
|
||||||
|
|
||||||
class CaseReport(TypedDict):
|
|
||||||
status: "CaseStatus"
|
|
||||||
|
|
||||||
|
|
||||||
class CaseStatusSuccess(TypedDict):
|
|
||||||
status: Literal["Succeeded"]
|
|
||||||
steps_executed: int
|
|
||||||
|
|
||||||
|
|
||||||
class CaseStatusFailure(TypedDict):
|
|
||||||
status: Literal["Failed"]
|
|
||||||
reason: str
|
|
||||||
|
|
||||||
|
|
||||||
class CaseStatusIgnored(TypedDict):
|
|
||||||
status: Literal["Ignored"]
|
|
||||||
reason: str
|
|
||||||
|
|
||||||
|
|
||||||
CaseStatus = Union[CaseStatusSuccess, CaseStatusFailure, CaseStatusIgnored]
|
|
||||||
"""A union type of all of the possible statuses that could be reported for a case."""
|
|
||||||
|
|
||||||
TestSpecifier = str
|
|
||||||
"""A test specifier string. For example resolc-compiler-tests/fixtures/solidity/test.json::0::Y+"""
|
|
||||||
|
|
||||||
ModeString = str
|
|
||||||
"""The mode string. For example Y+ >=0.8.13"""
|
|
||||||
|
|
||||||
MetadataFilePathString = str
|
|
||||||
"""The path to a metadata file. For example resolc-compiler-tests/fixtures/solidity/test.json"""
|
|
||||||
|
|
||||||
CaseIdxString = str
|
|
||||||
"""The index of a case as a string. For example '0'"""
|
|
||||||
|
|
||||||
|
|
||||||
def path_relative_to_resolc_compiler_test_directory(path: str) -> str:
|
|
||||||
"""
|
|
||||||
Given a path, this function returns the path relative to the resolc-compiler-test directory. The
|
|
||||||
following is an example of an input and an output:
|
|
||||||
|
|
||||||
Input: ~/polkadot-sdk/revive-differential-tests/resolc-compiler-tests/fixtures/solidity/test.json
|
|
||||||
Output: test.json
|
|
||||||
"""
|
|
||||||
|
|
||||||
return f"{path.split('resolc-compiler-tests/fixtures/solidity')[-1].strip('/')}"
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
with open("report.json", "r") as file:
|
|
||||||
report: Report = json.load(file)
|
|
||||||
|
|
||||||
# Starting the markdown document and adding information to it as we go.
|
|
||||||
markdown_document: io.TextIOWrapper = open("report.md", "w")
|
|
||||||
print("# Differential Tests Results", file=markdown_document)
|
|
||||||
|
|
||||||
# Getting all of the test specifiers from the report and making them relative to the tests dir.
|
|
||||||
test_specifiers: list[str] = list(
|
|
||||||
map(
|
|
||||||
path_relative_to_resolc_compiler_test_directory,
|
|
||||||
report["context"]["Test"]["corpus_configuration"]["test_specifiers"],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
print("## Specified Tests", file=markdown_document)
|
|
||||||
for test_specifier in test_specifiers:
|
|
||||||
print(f"* `{test_specifier}`", file=markdown_document)
|
|
||||||
|
|
||||||
# Counting the total number of test cases, successes, failures, and ignored tests
|
|
||||||
total_number_of_cases: int = 0
|
|
||||||
total_number_of_successes: int = 0
|
|
||||||
total_number_of_failures: int = 0
|
|
||||||
total_number_of_ignores: int = 0
|
|
||||||
for _, mode_to_case_mapping in report["execution_information"].items():
|
|
||||||
for _, case_idx_to_report_mapping in mode_to_case_mapping.items():
|
|
||||||
for _, case_report in case_idx_to_report_mapping.items():
|
|
||||||
status: CaseStatus = case_report["status"]
|
|
||||||
|
|
||||||
total_number_of_cases += 1
|
|
||||||
if status["status"] == "Succeeded":
|
|
||||||
total_number_of_successes += 1
|
|
||||||
elif status["status"] == "Failed":
|
|
||||||
total_number_of_failures += 1
|
|
||||||
elif status["status"] == "Ignored":
|
|
||||||
total_number_of_ignores += 1
|
|
||||||
else:
|
|
||||||
raise Exception(
|
|
||||||
f"Encountered a status that's unknown to the script: {status}"
|
|
||||||
)
|
|
||||||
|
|
||||||
print("## Counts", file=markdown_document)
|
|
||||||
print(
|
|
||||||
f"* **Total Number of Test Cases:** {total_number_of_cases}",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
f"* **Total Number of Successes:** {total_number_of_successes}",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
f"* **Total Number of Failures:** {total_number_of_failures}",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
f"* **Total Number of Ignores:** {total_number_of_ignores}",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Grouping the various test cases into dictionaries and groups depending on their status to make
|
|
||||||
# them easier to include in the markdown document later on.
|
|
||||||
successful_cases: dict[
|
|
||||||
MetadataFilePathString, dict[CaseIdxString, set[ModeString]]
|
|
||||||
] = {}
|
|
||||||
for metadata_file_path, mode_to_case_mapping in report[
|
|
||||||
"execution_information"
|
|
||||||
].items():
|
|
||||||
for mode_string, case_idx_to_report_mapping in mode_to_case_mapping.items():
|
|
||||||
for case_idx_string, case_report in case_idx_to_report_mapping.items():
|
|
||||||
status: CaseStatus = case_report["status"]
|
|
||||||
metadata_file_path: str = (
|
|
||||||
path_relative_to_resolc_compiler_test_directory(metadata_file_path)
|
|
||||||
)
|
|
||||||
mode_string: str = mode_string.replace(" M3", "+").replace(" M0", "-")
|
|
||||||
|
|
||||||
if status["status"] == "Succeeded":
|
|
||||||
successful_cases.setdefault(
|
|
||||||
metadata_file_path,
|
|
||||||
{},
|
|
||||||
).setdefault(
|
|
||||||
case_idx_string, set()
|
|
||||||
).add(mode_string)
|
|
||||||
|
|
||||||
print("## Failures", file=markdown_document)
|
|
||||||
print(
|
|
||||||
"The test specifiers seen in this section have the format 'path::case_idx::compilation_mode'\
|
|
||||||
and they're compatible with the revive differential tests framework and can be specified\
|
|
||||||
to it directly in the same way that they're provided through the `--test` argument of the\
|
|
||||||
framework.\n",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
"The failures are provided in an expandable section to ensure that the PR does not get \
|
|
||||||
polluted with information. Please click on the section below for more information",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
"<details><summary>Detailed Differential Tests Failure Information</summary>\n\n",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print("| Test Specifier | Failure Reason | Note |", file=markdown_document)
|
|
||||||
print("| -- | -- | -- |", file=markdown_document)
|
|
||||||
|
|
||||||
for metadata_file_path, mode_to_case_mapping in report[
|
|
||||||
"execution_information"
|
|
||||||
].items():
|
|
||||||
for mode_string, case_idx_to_report_mapping in mode_to_case_mapping.items():
|
|
||||||
for case_idx_string, case_report in case_idx_to_report_mapping.items():
|
|
||||||
status: CaseStatus = case_report["status"]
|
|
||||||
metadata_file_path: str = (
|
|
||||||
path_relative_to_resolc_compiler_test_directory(metadata_file_path)
|
|
||||||
)
|
|
||||||
mode_string: str = mode_string.replace(" M3", "+").replace(" M0", "-")
|
|
||||||
|
|
||||||
if status["status"] != "Failed":
|
|
||||||
continue
|
|
||||||
|
|
||||||
failure_reason: str = status["reason"].replace("\n", " ")
|
|
||||||
|
|
||||||
note: str = ""
|
|
||||||
modes_where_this_case_succeeded: set[ModeString] = (
|
|
||||||
successful_cases.setdefault(
|
|
||||||
metadata_file_path,
|
|
||||||
{},
|
|
||||||
).setdefault(case_idx_string, set())
|
|
||||||
)
|
|
||||||
if len(modes_where_this_case_succeeded) != 0:
|
|
||||||
note: str = (
|
|
||||||
f"This test case succeeded with other compilation modes: {modes_where_this_case_succeeded}"
|
|
||||||
)
|
|
||||||
|
|
||||||
test_specifier: str = (
|
|
||||||
f"{metadata_file_path}::{case_idx_string}::{mode_string}"
|
|
||||||
)
|
|
||||||
print(
|
|
||||||
f"| `{test_specifier}` | `{failure_reason}` | {note} |",
|
|
||||||
file=markdown_document,
|
|
||||||
)
|
|
||||||
print("\n\n</details>", file=markdown_document)
|
|
||||||
|
|
||||||
# The primary downside of not using `with`, but I guess it's better since I don't want to over
|
|
||||||
# indent the code.
|
|
||||||
markdown_document.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
Reference in New Issue
Block a user