mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-11 16:41:01 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 936676a92c | |||
| 6da3172581 | |||
| c6eb04b04e | |||
| e5114d31dc |
@@ -15,6 +15,7 @@ concurrency:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
POLKADOT_VERSION: polkadot-stable2506-2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cache-polkadot:
|
cache-polkadot:
|
||||||
@@ -65,6 +66,37 @@ jobs:
|
|||||||
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
|
||||||
|
id: cache-polkadot
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/polkadot-cache/polkadot
|
||||||
|
~/polkadot-cache/polkadot-execute-worker
|
||||||
|
~/polkadot-cache/polkadot-prepare-worker
|
||||||
|
~/polkadot-cache/polkadot-parachain
|
||||||
|
key: polkadot-downloaded-${{ matrix.os }}-${{ env.POLKADOT_VERSION }}
|
||||||
|
|
||||||
|
- name: Download Polkadot binaries on macOS
|
||||||
|
if: matrix.os == 'macos-14' && steps.cache-polkadot.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/polkadot-cache
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-aarch64-apple-darwin -o ~/polkadot-cache/polkadot
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-execute-worker-aarch64-apple-darwin -o ~/polkadot-cache/polkadot-execute-worker
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-prepare-worker-aarch64-apple-darwin -o ~/polkadot-cache/polkadot-prepare-worker
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-parachain-aarch64-apple-darwin -o ~/polkadot-cache/polkadot-parachain
|
||||||
|
chmod +x ~/polkadot-cache/*
|
||||||
|
|
||||||
|
- name: Download Polkadot binaries on Ubuntu
|
||||||
|
if: matrix.os == 'ubuntu-24.04' && steps.cache-polkadot.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/polkadot-cache
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot -o ~/polkadot-cache/polkadot
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-execute-worker -o ~/polkadot-cache/polkadot-execute-worker
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-prepare-worker -o ~/polkadot-cache/polkadot-prepare-worker
|
||||||
|
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/${{ env.POLKADOT_VERSION }}/polkadot-parachain -o ~/polkadot-cache/polkadot-parachain
|
||||||
|
chmod +x ~/polkadot-cache/*
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
name: CI on ${{ matrix.os }}
|
name: CI on ${{ matrix.os }}
|
||||||
@@ -86,6 +118,24 @@ jobs:
|
|||||||
~/.cargo/bin/eth-rpc
|
~/.cargo/bin/eth-rpc
|
||||||
key: polkadot-binaries-${{ matrix.os }}-${{ hashFiles('polkadot-sdk/.git') }}
|
key: polkadot-binaries-${{ matrix.os }}-${{ hashFiles('polkadot-sdk/.git') }}
|
||||||
|
|
||||||
|
- name: Restore downloaded Polkadot binaries from cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/polkadot-cache/polkadot
|
||||||
|
~/polkadot-cache/polkadot-execute-worker
|
||||||
|
~/polkadot-cache/polkadot-prepare-worker
|
||||||
|
~/polkadot-cache/polkadot-parachain
|
||||||
|
key: polkadot-downloaded-${{ matrix.os }}-${{ env.POLKADOT_VERSION }}
|
||||||
|
|
||||||
|
- name: Install Polkadot binaries
|
||||||
|
run: |
|
||||||
|
sudo cp ~/polkadot-cache/polkadot /usr/local/bin/
|
||||||
|
sudo cp ~/polkadot-cache/polkadot-execute-worker /usr/local/bin/
|
||||||
|
sudo cp ~/polkadot-cache/polkadot-prepare-worker /usr/local/bin/
|
||||||
|
sudo cp ~/polkadot-cache/polkadot-parachain /usr/local/bin/
|
||||||
|
sudo chmod +x /usr/local/bin/polkadot*
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
@@ -170,6 +220,18 @@ jobs:
|
|||||||
- name: Check resolc version
|
- name: Check resolc version
|
||||||
run: resolc --version
|
run: resolc --version
|
||||||
|
|
||||||
|
- name: Check polkadot version
|
||||||
|
run: polkadot --version
|
||||||
|
|
||||||
|
- name: Check polkadot-parachain version
|
||||||
|
run: polkadot-parachain --version
|
||||||
|
|
||||||
|
- name: Check polkadot-execute-worker version
|
||||||
|
run: polkadot-execute-worker --version
|
||||||
|
|
||||||
|
- name: Check polkadot-prepare-worker version
|
||||||
|
run: polkadot-prepare-worker --version
|
||||||
|
|
||||||
- name: Test Formatting
|
- name: Test Formatting
|
||||||
run: make format
|
run: make format
|
||||||
|
|
||||||
|
|||||||
Generated
+2126
-57
File diff suppressed because it is too large
Load Diff
@@ -73,6 +73,8 @@ revive-solc-json-interface = { git = "https://github.com/paritytech/revive", rev
|
|||||||
revive-common = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
revive-common = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||||
revive-differential = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
revive-differential = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||||
|
|
||||||
|
zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev ="891f6554354ce466abd496366dbf8b4f82141241" }
|
||||||
|
|
||||||
[workspace.dependencies.alloy]
|
[workspace.dependencies.alloy]
|
||||||
version = "1.0.37"
|
version = "1.0.37"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ pub enum PlatformIdentifier {
|
|||||||
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,
|
||||||
|
/// A zombienet based Substrate/Polkadot node with the PolkaVM backend with the resolc compiler.
|
||||||
|
ZombienetPolkavmResolc,
|
||||||
|
/// A zombienet based Substrate/Polkadot node with the REVM backend with the solc compiler.
|
||||||
|
ZombienetRevmSolc,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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.
|
||||||
@@ -95,6 +99,8 @@ pub enum NodeIdentifier {
|
|||||||
Kitchensink,
|
Kitchensink,
|
||||||
/// The revive dev node implementation.
|
/// The revive dev node implementation.
|
||||||
ReviveDevNode,
|
ReviveDevNode,
|
||||||
|
/// A zombienet spawned nodes
|
||||||
|
Zombienet,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum representing the identifiers of the supported VMs.
|
/// An enum representing the identifiers of the supported VMs.
|
||||||
|
|||||||
@@ -107,6 +107,16 @@ impl AsRef<KurtosisConfiguration> for Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<PolkadotParachainConfiguration> for Context {
|
||||||
|
fn as_ref(&self) -> &PolkadotParachainConfiguration {
|
||||||
|
match self {
|
||||||
|
Self::Test(context) => context.as_ref().as_ref(),
|
||||||
|
Self::Benchmark(context) => context.as_ref().as_ref(),
|
||||||
|
Self::ExportJsonSchema => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<KitchensinkConfiguration> for Context {
|
impl AsRef<KitchensinkConfiguration> for Context {
|
||||||
fn as_ref(&self) -> &KitchensinkConfiguration {
|
fn as_ref(&self) -> &KitchensinkConfiguration {
|
||||||
match self {
|
match self {
|
||||||
@@ -225,6 +235,10 @@ pub struct TestExecutionContext {
|
|||||||
#[clap(flatten, next_help_heading = "Resolc Configuration")]
|
#[clap(flatten, next_help_heading = "Resolc Configuration")]
|
||||||
pub resolc_configuration: ResolcConfiguration,
|
pub resolc_configuration: ResolcConfiguration,
|
||||||
|
|
||||||
|
/// Configuration parameters for the Polkadot Parachain.
|
||||||
|
#[clap(flatten, next_help_heading = "Polkadot Parachain Configuration")]
|
||||||
|
pub polkadot_parachain_configuration: PolkadotParachainConfiguration,
|
||||||
|
|
||||||
/// Configuration parameters for the geth node.
|
/// Configuration parameters for the geth node.
|
||||||
#[clap(flatten, next_help_heading = "Geth Configuration")]
|
#[clap(flatten, next_help_heading = "Geth Configuration")]
|
||||||
pub geth_configuration: GethConfiguration,
|
pub geth_configuration: GethConfiguration,
|
||||||
@@ -318,6 +332,10 @@ pub struct BenchmarkingContext {
|
|||||||
#[clap(flatten, next_help_heading = "Kitchensink Configuration")]
|
#[clap(flatten, next_help_heading = "Kitchensink Configuration")]
|
||||||
pub kitchensink_configuration: KitchensinkConfiguration,
|
pub kitchensink_configuration: KitchensinkConfiguration,
|
||||||
|
|
||||||
|
/// Configuration parameters for the Polkadot Parachain.
|
||||||
|
#[clap(flatten, next_help_heading = "Polkadot Parachain Configuration")]
|
||||||
|
pub polkadot_parachain_configuration: PolkadotParachainConfiguration,
|
||||||
|
|
||||||
/// 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,
|
||||||
@@ -379,6 +397,12 @@ impl AsRef<GethConfiguration> for TestExecutionContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<PolkadotParachainConfiguration> for TestExecutionContext {
|
||||||
|
fn as_ref(&self) -> &PolkadotParachainConfiguration {
|
||||||
|
&self.polkadot_parachain_configuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<KurtosisConfiguration> for TestExecutionContext {
|
impl AsRef<KurtosisConfiguration> for TestExecutionContext {
|
||||||
fn as_ref(&self) -> &KurtosisConfiguration {
|
fn as_ref(&self) -> &KurtosisConfiguration {
|
||||||
&self.lighthouse_configuration
|
&self.lighthouse_configuration
|
||||||
@@ -475,6 +499,12 @@ impl AsRef<KurtosisConfiguration> for BenchmarkingContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AsRef<PolkadotParachainConfiguration> for BenchmarkingContext {
|
||||||
|
fn as_ref(&self) -> &PolkadotParachainConfiguration {
|
||||||
|
&self.polkadot_parachain_configuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AsRef<KitchensinkConfiguration> for BenchmarkingContext {
|
impl AsRef<KitchensinkConfiguration> for BenchmarkingContext {
|
||||||
fn as_ref(&self) -> &KitchensinkConfiguration {
|
fn as_ref(&self) -> &KitchensinkConfiguration {
|
||||||
&self.kitchensink_configuration
|
&self.kitchensink_configuration
|
||||||
@@ -545,6 +575,30 @@ pub struct ResolcConfiguration {
|
|||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A set of configuration parameters for Polkadot Parachain.
|
||||||
|
#[derive(Clone, Debug, Parser, Serialize)]
|
||||||
|
pub struct PolkadotParachainConfiguration {
|
||||||
|
/// Specifies the path of the polkadot-parachain node to be used by the tool.
|
||||||
|
///
|
||||||
|
/// If this is not specified, then the tool assumes that it should use the polkadot-parachain binary
|
||||||
|
/// that's provided in the user's $PATH.
|
||||||
|
#[clap(
|
||||||
|
id = "polkadot-parachain.path",
|
||||||
|
long = "polkadot-parachain.path",
|
||||||
|
default_value = "polkadot-parachain"
|
||||||
|
)]
|
||||||
|
pub path: PathBuf,
|
||||||
|
|
||||||
|
/// The amount of time to wait upon startup before considering that the node timed out.
|
||||||
|
#[clap(
|
||||||
|
id = "polkadot-parachain.start-timeout-ms",
|
||||||
|
long = "polkadot-parachain.start-timeout-ms",
|
||||||
|
default_value = "5000",
|
||||||
|
value_parser = parse_duration
|
||||||
|
)]
|
||||||
|
pub start_timeout_ms: Duration,
|
||||||
|
}
|
||||||
|
|
||||||
/// A set of configuration parameters for Geth.
|
/// A set of configuration parameters for Geth.
|
||||||
#[derive(Clone, Debug, Parser, Serialize)]
|
#[derive(Clone, Debug, Parser, Serialize)]
|
||||||
pub struct GethConfiguration {
|
pub struct GethConfiguration {
|
||||||
@@ -893,4 +947,6 @@ pub enum TestingPlatform {
|
|||||||
Geth,
|
Geth,
|
||||||
/// The kitchensink runtime provides the PolkaVM (PVM) based node implementation.
|
/// The kitchensink runtime provides the PolkaVM (PVM) based node implementation.
|
||||||
Kitchensink,
|
Kitchensink,
|
||||||
|
/// A polkadot/Substrate based network
|
||||||
|
Zombienet,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ use revive_dt_format::{
|
|||||||
traits::ResolutionContext,
|
traits::ResolutionContext,
|
||||||
};
|
};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tracing::{debug, error, info, instrument};
|
use tracing::{error, info, instrument};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
differential_tests::ExecutionState,
|
differential_tests::ExecutionState,
|
||||||
@@ -109,7 +109,6 @@ impl<'a> Driver<'a, StepsIterator> {
|
|||||||
// endregion:Constructors
|
// endregion:Constructors
|
||||||
|
|
||||||
// region:Execution
|
// region:Execution
|
||||||
#[instrument(level = "info", skip_all)]
|
|
||||||
pub async fn execute_all(mut self) -> Result<usize> {
|
pub async fn execute_all(mut self) -> Result<usize> {
|
||||||
let platform_drivers = std::mem::take(&mut self.platform_drivers);
|
let platform_drivers = std::mem::take(&mut self.platform_drivers);
|
||||||
let results = futures::future::try_join_all(
|
let results = futures::future::try_join_all(
|
||||||
@@ -218,8 +217,6 @@ where
|
|||||||
.flatten()
|
.flatten()
|
||||||
.flat_map(|(_, map)| map.values())
|
.flat_map(|(_, map)| map.values())
|
||||||
{
|
{
|
||||||
debug!(%library_instance, "Deploying Library Instance");
|
|
||||||
|
|
||||||
let ContractPathAndIdent {
|
let ContractPathAndIdent {
|
||||||
contract_source_path: library_source_path,
|
contract_source_path: library_source_path,
|
||||||
contract_ident: library_ident,
|
contract_ident: library_ident,
|
||||||
@@ -268,12 +265,6 @@ where
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
debug!(
|
|
||||||
?library_instance,
|
|
||||||
platform_identifier = %platform_information.platform.platform_identifier(),
|
|
||||||
"Deployed library"
|
|
||||||
);
|
|
||||||
|
|
||||||
let library_address = receipt
|
let library_address = receipt
|
||||||
.contract_address
|
.contract_address
|
||||||
.expect("Failed to deploy the library");
|
.expect("Failed to deploy the library");
|
||||||
@@ -312,7 +303,6 @@ where
|
|||||||
// endregion:Constructors & Initialization
|
// endregion:Constructors & Initialization
|
||||||
|
|
||||||
// region:Step Handling
|
// region:Step Handling
|
||||||
#[instrument(level = "info", skip_all)]
|
|
||||||
pub async fn execute_all(mut self) -> Result<usize> {
|
pub async fn execute_all(mut self) -> Result<usize> {
|
||||||
while let Some(result) = self.execute_next_step().await {
|
while let Some(result) = self.execute_next_step().await {
|
||||||
result?
|
result?
|
||||||
@@ -320,14 +310,6 @@ where
|
|||||||
Ok(self.steps_executed)
|
Ok(self.steps_executed)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(
|
|
||||||
level = "info",
|
|
||||||
skip_all,
|
|
||||||
fields(
|
|
||||||
platform_identifier = %self.platform_information.platform.platform_identifier(),
|
|
||||||
node_id = self.platform_information.node.id(),
|
|
||||||
),
|
|
||||||
)]
|
|
||||||
pub async fn execute_next_step(&mut self) -> Option<Result<()>> {
|
pub async fn execute_next_step(&mut self) -> Option<Result<()>> {
|
||||||
let (step_path, step) = self.steps_iterator.next()?;
|
let (step_path, step) = self.steps_iterator.next()?;
|
||||||
info!(%step_path, "Executing Step");
|
info!(%step_path, "Executing Step");
|
||||||
@@ -344,6 +326,7 @@ where
|
|||||||
skip_all,
|
skip_all,
|
||||||
fields(
|
fields(
|
||||||
platform_identifier = %self.platform_information.platform.platform_identifier(),
|
platform_identifier = %self.platform_information.platform.platform_identifier(),
|
||||||
|
node_id = self.platform_information.node.id(),
|
||||||
%step_path,
|
%step_path,
|
||||||
),
|
),
|
||||||
err(Debug),
|
err(Debug),
|
||||||
@@ -402,6 +385,7 @@ where
|
|||||||
Ok(1)
|
Ok(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip_all)]
|
||||||
async fn handle_function_call_contract_deployment(
|
async fn handle_function_call_contract_deployment(
|
||||||
&mut self,
|
&mut self,
|
||||||
step: &FunctionCallStep,
|
step: &FunctionCallStep,
|
||||||
@@ -447,6 +431,7 @@ where
|
|||||||
Ok(receipts)
|
Ok(receipts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip_all)]
|
||||||
async fn handle_function_call_execution(
|
async fn handle_function_call_execution(
|
||||||
&mut self,
|
&mut self,
|
||||||
step: &FunctionCallStep,
|
step: &FunctionCallStep,
|
||||||
@@ -470,14 +455,12 @@ where
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
match self.platform_information.node.execute_transaction(tx).await {
|
self.platform_information.node.execute_transaction(tx).await
|
||||||
Ok(receipt) => Ok(receipt),
|
|
||||||
Err(err) => Err(err),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip_all)]
|
||||||
async fn handle_function_call_call_frame_tracing(
|
async fn handle_function_call_call_frame_tracing(
|
||||||
&mut self,
|
&mut self,
|
||||||
tx_hash: TxHash,
|
tx_hash: TxHash,
|
||||||
@@ -509,6 +492,7 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip_all)]
|
||||||
async fn handle_function_call_variable_assignment(
|
async fn handle_function_call_variable_assignment(
|
||||||
&mut self,
|
&mut self,
|
||||||
step: &FunctionCallStep,
|
step: &FunctionCallStep,
|
||||||
@@ -541,6 +525,7 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip_all)]
|
||||||
async fn handle_function_call_assertions(
|
async fn handle_function_call_assertions(
|
||||||
&mut self,
|
&mut self,
|
||||||
step: &FunctionCallStep,
|
step: &FunctionCallStep,
|
||||||
@@ -583,6 +568,7 @@ where
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "debug", skip_all)]
|
||||||
async fn handle_function_call_assertion_item(
|
async fn handle_function_call_assertion_item(
|
||||||
&self,
|
&self,
|
||||||
receipt: &TransactionReceipt,
|
receipt: &TransactionReceipt,
|
||||||
@@ -865,7 +851,6 @@ where
|
|||||||
level = "info",
|
level = "info",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(
|
fields(
|
||||||
platform_identifier = %self.platform_information.platform.platform_identifier(),
|
|
||||||
%contract_instance,
|
%contract_instance,
|
||||||
%deployer
|
%deployer
|
||||||
),
|
),
|
||||||
@@ -907,7 +892,6 @@ where
|
|||||||
level = "info",
|
level = "info",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(
|
fields(
|
||||||
platform_identifier = %self.platform_information.platform.platform_identifier(),
|
|
||||||
%contract_instance,
|
%contract_instance,
|
||||||
%deployer
|
%deployer
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
//! The main entry point into differential testing.
|
//! The main entry point into differential testing.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::BTreeMap,
|
collections::{BTreeMap, BTreeSet},
|
||||||
io::{BufWriter, Write, stderr},
|
io::{BufWriter, Write, stderr},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::Instant,
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
use revive_dt_common::types::PrivateKeyAllocator;
|
use revive_dt_common::types::PrivateKeyAllocator;
|
||||||
use revive_dt_core::Platform;
|
use revive_dt_core::Platform;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::{Mutex, RwLock, Semaphore};
|
||||||
use tracing::{Instrument, error, info, info_span, instrument};
|
use tracing::{Instrument, error, info, info_span, instrument};
|
||||||
|
|
||||||
use revive_dt_config::{Context, TestExecutionContext};
|
use revive_dt_config::{Context, TestExecutionContext};
|
||||||
@@ -101,20 +101,40 @@ pub async fn handle_differential_tests(
|
|||||||
)));
|
)));
|
||||||
|
|
||||||
// Creating the driver and executing all of the steps.
|
// Creating the driver and executing all of the steps.
|
||||||
let driver_task = futures::future::join_all(test_definitions.iter().map(|test_definition| {
|
let semaphore = context
|
||||||
let private_key_allocator = private_key_allocator.clone();
|
.concurrency_configuration
|
||||||
let cached_compiler = cached_compiler.clone();
|
.concurrency_limit()
|
||||||
let mode = test_definition.mode.clone();
|
.map(Semaphore::new)
|
||||||
let span = info_span!(
|
.map(Arc::new);
|
||||||
"Executing Test Case",
|
let running_task_list = Arc::new(RwLock::new(BTreeSet::<usize>::new()));
|
||||||
metadata_file_path = %test_definition.metadata_file_path.display(),
|
let driver_task = futures::future::join_all(test_definitions.iter().enumerate().map(
|
||||||
case_idx = %test_definition.case_idx,
|
|(test_id, test_definition)| {
|
||||||
mode = %mode
|
let running_task_list = running_task_list.clone();
|
||||||
);
|
let semaphore = semaphore.clone();
|
||||||
async move {
|
|
||||||
let driver =
|
let private_key_allocator = private_key_allocator.clone();
|
||||||
match Driver::new_root(test_definition, private_key_allocator, &cached_compiler)
|
let cached_compiler = cached_compiler.clone();
|
||||||
.await
|
let mode = test_definition.mode.clone();
|
||||||
|
let span = info_span!(
|
||||||
|
"Executing Test Case",
|
||||||
|
test_id,
|
||||||
|
metadata_file_path = %test_definition.metadata_file_path.display(),
|
||||||
|
case_idx = %test_definition.case_idx,
|
||||||
|
mode = %mode,
|
||||||
|
);
|
||||||
|
async move {
|
||||||
|
let permit = match semaphore.as_ref() {
|
||||||
|
Some(semaphore) => Some(semaphore.acquire().await.expect("Can't fail")),
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
running_task_list.write().await.insert(test_id);
|
||||||
|
let driver = match Driver::new_root(
|
||||||
|
test_definition,
|
||||||
|
private_key_allocator,
|
||||||
|
&cached_compiler,
|
||||||
|
)
|
||||||
|
.await
|
||||||
{
|
{
|
||||||
Ok(driver) => driver,
|
Ok(driver) => driver,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
@@ -123,28 +143,33 @@ pub async fn handle_differential_tests(
|
|||||||
.report_test_failed_event(format!("{error:#}"))
|
.report_test_failed_event(format!("{error:#}"))
|
||||||
.expect("Can't fail");
|
.expect("Can't fail");
|
||||||
error!("Test Case Failed");
|
error!("Test Case Failed");
|
||||||
|
drop(permit);
|
||||||
|
running_task_list.write().await.remove(&test_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
info!("Created the driver for the test case");
|
info!("Created the driver for the test case");
|
||||||
|
|
||||||
match driver.execute_all().await {
|
match driver.execute_all().await {
|
||||||
Ok(steps_executed) => test_definition
|
Ok(steps_executed) => test_definition
|
||||||
.reporter
|
|
||||||
.report_test_succeeded_event(steps_executed)
|
|
||||||
.expect("Can't fail"),
|
|
||||||
Err(error) => {
|
|
||||||
test_definition
|
|
||||||
.reporter
|
.reporter
|
||||||
.report_test_failed_event(format!("{error:#}"))
|
.report_test_succeeded_event(steps_executed)
|
||||||
.expect("Can't fail");
|
.expect("Can't fail"),
|
||||||
error!("Test Case Failed");
|
Err(error) => {
|
||||||
}
|
test_definition
|
||||||
};
|
.reporter
|
||||||
info!("Finished the execution of the test case")
|
.report_test_failed_event(format!("{error:#}"))
|
||||||
}
|
.expect("Can't fail");
|
||||||
.instrument(span)
|
error!("Test Case Failed");
|
||||||
}))
|
}
|
||||||
|
};
|
||||||
|
info!("Finished the execution of the test case");
|
||||||
|
drop(permit);
|
||||||
|
running_task_list.write().await.remove(&test_id);
|
||||||
|
}
|
||||||
|
.instrument(span)
|
||||||
|
},
|
||||||
|
))
|
||||||
.inspect(|_| {
|
.inspect(|_| {
|
||||||
info!("Finished executing all test cases");
|
info!("Finished executing all test cases");
|
||||||
reporter_clone
|
reporter_clone
|
||||||
@@ -153,6 +178,18 @@ pub async fn handle_differential_tests(
|
|||||||
});
|
});
|
||||||
let cli_reporting_task = start_cli_reporting_task(reporter);
|
let cli_reporting_task = start_cli_reporting_task(reporter);
|
||||||
|
|
||||||
|
tokio::task::spawn(async move {
|
||||||
|
loop {
|
||||||
|
let remaining_tasks = running_task_list.read().await;
|
||||||
|
info!(
|
||||||
|
count = remaining_tasks.len(),
|
||||||
|
?remaining_tasks,
|
||||||
|
"Remaining Tests"
|
||||||
|
);
|
||||||
|
tokio::time::sleep(Duration::from_secs(10)).await
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
futures::future::join(driver_task, cli_reporting_task).await;
|
futures::future::join(driver_task, cli_reporting_task).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
+105
-1
@@ -16,7 +16,7 @@ use revive_dt_config::*;
|
|||||||
use revive_dt_node::{
|
use revive_dt_node::{
|
||||||
Node, node_implementations::geth::GethNode,
|
Node, node_implementations::geth::GethNode,
|
||||||
node_implementations::lighthouse_geth::LighthouseGethNode,
|
node_implementations::lighthouse_geth::LighthouseGethNode,
|
||||||
node_implementations::substrate::SubstrateNode,
|
node_implementations::substrate::SubstrateNode, node_implementations::zombienet::ZombieNode,
|
||||||
};
|
};
|
||||||
use revive_dt_node_interaction::EthereumNode;
|
use revive_dt_node_interaction::EthereumNode;
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
@@ -359,6 +359,102 @@ impl Platform for ReviveDevNodeRevmSolcPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
||||||
|
pub struct ZombienetPolkavmResolcPlatform;
|
||||||
|
|
||||||
|
impl Platform for ZombienetPolkavmResolcPlatform {
|
||||||
|
fn platform_identifier(&self) -> PlatformIdentifier {
|
||||||
|
PlatformIdentifier::ZombienetPolkavmResolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_identifier(&self) -> NodeIdentifier {
|
||||||
|
NodeIdentifier::Zombienet
|
||||||
|
}
|
||||||
|
|
||||||
|
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 polkadot_parachain_path = AsRef::<PolkadotParachainConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.clone();
|
||||||
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
|
Ok(thread::spawn(move || {
|
||||||
|
let node = ZombieNode::new(polkadot_parachain_path, 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>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
|
||||||
|
pub struct ZombienetRevmSolcPlatform;
|
||||||
|
|
||||||
|
impl Platform for ZombienetRevmSolcPlatform {
|
||||||
|
fn platform_identifier(&self) -> PlatformIdentifier {
|
||||||
|
PlatformIdentifier::ZombienetRevmSolc
|
||||||
|
}
|
||||||
|
|
||||||
|
fn node_identifier(&self) -> NodeIdentifier {
|
||||||
|
NodeIdentifier::Zombienet
|
||||||
|
}
|
||||||
|
|
||||||
|
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 polkadot_parachain_path = AsRef::<PolkadotParachainConfiguration>::as_ref(&context)
|
||||||
|
.path
|
||||||
|
.clone();
|
||||||
|
let genesis = genesis_configuration.genesis()?.clone();
|
||||||
|
Ok(thread::spawn(move || {
|
||||||
|
let node = ZombieNode::new(polkadot_parachain_path, 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>)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<PlatformIdentifier> for Box<dyn Platform> {
|
impl From<PlatformIdentifier> for Box<dyn Platform> {
|
||||||
fn from(value: PlatformIdentifier) -> Self {
|
fn from(value: PlatformIdentifier) -> Self {
|
||||||
match value {
|
match value {
|
||||||
@@ -378,6 +474,10 @@ impl From<PlatformIdentifier> for Box<dyn Platform> {
|
|||||||
PlatformIdentifier::ReviveDevNodeRevmSolc => {
|
PlatformIdentifier::ReviveDevNodeRevmSolc => {
|
||||||
Box::new(ReviveDevNodeRevmSolcPlatform) as Box<_>
|
Box::new(ReviveDevNodeRevmSolcPlatform) as Box<_>
|
||||||
}
|
}
|
||||||
|
PlatformIdentifier::ZombienetPolkavmResolc => {
|
||||||
|
Box::new(ZombienetPolkavmResolcPlatform) as Box<_>
|
||||||
|
}
|
||||||
|
PlatformIdentifier::ZombienetRevmSolc => Box::new(ZombienetRevmSolcPlatform) as Box<_>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,6 +501,10 @@ impl From<PlatformIdentifier> for &dyn Platform {
|
|||||||
PlatformIdentifier::ReviveDevNodeRevmSolc => {
|
PlatformIdentifier::ReviveDevNodeRevmSolc => {
|
||||||
&ReviveDevNodeRevmSolcPlatform as &dyn Platform
|
&ReviveDevNodeRevmSolcPlatform as &dyn Platform
|
||||||
}
|
}
|
||||||
|
PlatformIdentifier::ZombienetPolkavmResolc => {
|
||||||
|
&ZombienetPolkavmResolcPlatform as &dyn Platform
|
||||||
|
}
|
||||||
|
PlatformIdentifier::ZombienetRevmSolc => &ZombienetRevmSolcPlatform as &dyn Platform,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ serde_yaml_ng = { workspace = true }
|
|||||||
|
|
||||||
sp-core = { workspace = true }
|
sp-core = { workspace = true }
|
||||||
sp-runtime = { workspace = true }
|
sp-runtime = { workspace = true }
|
||||||
|
zombienet-sdk = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
temp-dir = { workspace = true }
|
temp-dir = { workspace = true }
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use std::{
|
|||||||
pin::Pin,
|
pin::Pin,
|
||||||
process::{Command, Stdio},
|
process::{Command, Stdio},
|
||||||
sync::{
|
sync::{
|
||||||
Arc, LazyLock,
|
Arc,
|
||||||
atomic::{AtomicU32, Ordering},
|
atomic::{AtomicU32, Ordering},
|
||||||
},
|
},
|
||||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||||
@@ -47,7 +47,7 @@ use futures::{Stream, StreamExt};
|
|||||||
use revive_common::EVMVersion;
|
use revive_common::EVMVersion;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde_with::serde_as;
|
use serde_with::serde_as;
|
||||||
use tokio::sync::{OnceCell, Semaphore};
|
use tokio::sync::OnceCell;
|
||||||
use tracing::{Instrument, info, instrument};
|
use tracing::{Instrument, info, instrument};
|
||||||
|
|
||||||
use revive_dt_common::{
|
use revive_dt_common::{
|
||||||
@@ -105,7 +105,6 @@ pub struct LighthouseGethNode {
|
|||||||
|
|
||||||
persistent_http_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
persistent_http_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
persistent_ws_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
persistent_ws_provider: OnceCell<ConcreteProvider<Ethereum, Arc<EthereumWallet>>>,
|
||||||
http_provider_requests_semaphore: LazyLock<Semaphore>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LighthouseGethNode {
|
impl LighthouseGethNode {
|
||||||
@@ -176,7 +175,6 @@ impl LighthouseGethNode {
|
|||||||
nonce_manager: Default::default(),
|
nonce_manager: Default::default(),
|
||||||
persistent_http_provider: OnceCell::const_new(),
|
persistent_http_provider: OnceCell::const_new(),
|
||||||
persistent_ws_provider: OnceCell::const_new(),
|
persistent_ws_provider: OnceCell::const_new(),
|
||||||
http_provider_requests_semaphore: LazyLock::new(|| Semaphore::const_new(500)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,8 +564,6 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
transaction: TransactionRequest,
|
transaction: TransactionRequest,
|
||||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<TxHash>> + '_>> {
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<TxHash>> + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let _permit = self.http_provider_requests_semaphore.acquire().await;
|
|
||||||
|
|
||||||
let provider = self
|
let provider = self
|
||||||
.http_provider()
|
.http_provider()
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
pub mod geth;
|
pub mod geth;
|
||||||
pub mod lighthouse_geth;
|
pub mod lighthouse_geth;
|
||||||
pub mod substrate;
|
pub mod substrate;
|
||||||
|
pub mod zombienet;
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ use crate::{
|
|||||||
Node,
|
Node,
|
||||||
constants::{CHAIN_ID, INITIAL_BALANCE},
|
constants::{CHAIN_ID, INITIAL_BALANCE},
|
||||||
helpers::{Process, ProcessReadinessWaitBehavior},
|
helpers::{Process, ProcessReadinessWaitBehavior},
|
||||||
provider_utils::{ConcreteProvider, FallbackGasFiller, construct_concurrency_limited_provider},
|
provider_utils::{
|
||||||
|
ConcreteProvider, FallbackGasFiller, construct_concurrency_limited_provider,
|
||||||
|
execute_transaction,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static NODE_COUNT: AtomicU32 = AtomicU32::new(0);
|
static NODE_COUNT: AtomicU32 = AtomicU32::new(0);
|
||||||
@@ -80,7 +83,7 @@ pub struct SubstrateNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SubstrateNode {
|
impl SubstrateNode {
|
||||||
const BASE_DIRECTORY: &str = "Substrate";
|
const BASE_DIRECTORY: &str = "substrate";
|
||||||
const LOGS_DIRECTORY: &str = "logs";
|
const LOGS_DIRECTORY: &str = "logs";
|
||||||
const DATA_DIRECTORY: &str = "chains";
|
const DATA_DIRECTORY: &str = "chains";
|
||||||
|
|
||||||
@@ -346,7 +349,7 @@ impl SubstrateNode {
|
|||||||
.get_or_try_init(|| async move {
|
.get_or_try_init(|| async move {
|
||||||
construct_concurrency_limited_provider::<ReviveNetwork, _>(
|
construct_concurrency_limited_provider::<ReviveNetwork, _>(
|
||||||
self.rpc_url.as_str(),
|
self.rpc_url.as_str(),
|
||||||
FallbackGasFiller::new(250_000_000, 5_000_000_000, 1_000_000_000),
|
FallbackGasFiller::new(u64::MAX, 5_000_000_000, 1_000_000_000),
|
||||||
ChainIdFiller::new(Some(CHAIN_ID)),
|
ChainIdFiller::new(Some(CHAIN_ID)),
|
||||||
NonceFiller::new(self.nonce_manager.clone()),
|
NonceFiller::new(self.nonce_manager.clone()),
|
||||||
self.wallet.clone(),
|
self.wallet.clone(),
|
||||||
@@ -408,23 +411,12 @@ impl EthereumNode for SubstrateNode {
|
|||||||
&self,
|
&self,
|
||||||
transaction: TransactionRequest,
|
transaction: TransactionRequest,
|
||||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<TransactionReceipt>> + '_>> {
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<TransactionReceipt>> + '_>> {
|
||||||
static SEMAPHORE: std::sync::LazyLock<tokio::sync::Semaphore> =
|
|
||||||
std::sync::LazyLock::new(|| tokio::sync::Semaphore::new(500));
|
|
||||||
|
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let _permit = SEMAPHORE.acquire().await?;
|
let provider = self
|
||||||
|
|
||||||
let receipt = self
|
|
||||||
.provider()
|
.provider()
|
||||||
.await
|
.await
|
||||||
.context("Failed to create provider for transaction submission")?
|
.context("Failed to create the provider")?;
|
||||||
.send_transaction(transaction)
|
execute_transaction(provider, transaction).await
|
||||||
.await
|
|
||||||
.context("Failed to submit transaction to substrate proxy")?
|
|
||||||
.get_receipt()
|
|
||||||
.await
|
|
||||||
.context("Failed to fetch transaction receipt from substrate proxy")?;
|
|
||||||
Ok(receipt)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,16 @@
|
|||||||
use std::sync::LazyLock;
|
use std::{ops::ControlFlow, sync::LazyLock, time::Duration};
|
||||||
|
|
||||||
use alloy::{
|
use alloy::{
|
||||||
network::{Network, NetworkWallet, TransactionBuilder4844},
|
network::{Ethereum, Network, NetworkWallet, TransactionBuilder4844},
|
||||||
providers::{
|
providers::{
|
||||||
Identity, ProviderBuilder, RootProvider,
|
Identity, PendingTransactionBuilder, Provider, ProviderBuilder, RootProvider,
|
||||||
fillers::{ChainIdFiller, FillProvider, JoinFill, NonceFiller, TxFiller, WalletFiller},
|
fillers::{ChainIdFiller, FillProvider, JoinFill, NonceFiller, TxFiller, WalletFiller},
|
||||||
},
|
},
|
||||||
rpc::client::ClientBuilder,
|
rpc::client::ClientBuilder,
|
||||||
};
|
};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
|
use revive_dt_common::futures::{PollingWaitBehavior, poll};
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::provider_utils::{ConcurrencyLimiterLayer, FallbackGasFiller};
|
use crate::provider_utils::{ConcurrencyLimiterLayer, FallbackGasFiller};
|
||||||
|
|
||||||
@@ -61,3 +63,66 @@ where
|
|||||||
|
|
||||||
Ok(provider)
|
Ok(provider)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn execute_transaction<N, W>(
|
||||||
|
provider: ConcreteProvider<N, W>,
|
||||||
|
transaction: N::TransactionRequest,
|
||||||
|
) -> Result<N::ReceiptResponse>
|
||||||
|
where
|
||||||
|
N: Network<
|
||||||
|
TransactionRequest: TransactionBuilder4844,
|
||||||
|
TxEnvelope = <Ethereum as Network>::TxEnvelope,
|
||||||
|
>,
|
||||||
|
W: NetworkWallet<N>,
|
||||||
|
Identity: TxFiller<N>,
|
||||||
|
FallbackGasFiller: TxFiller<N>,
|
||||||
|
ChainIdFiller: TxFiller<N>,
|
||||||
|
NonceFiller: TxFiller<N>,
|
||||||
|
WalletFiller<W>: TxFiller<N>,
|
||||||
|
{
|
||||||
|
let sendable_transaction = provider
|
||||||
|
.fill(transaction)
|
||||||
|
.await
|
||||||
|
.context("Failed to fill transaction")?;
|
||||||
|
|
||||||
|
let transaction_envelope = sendable_transaction
|
||||||
|
.try_into_envelope()
|
||||||
|
.context("Failed to convert transaction into an envelope")?;
|
||||||
|
let tx_hash = *transaction_envelope.tx_hash();
|
||||||
|
|
||||||
|
let mut pending_transaction = match provider.send_tx_envelope(transaction_envelope).await {
|
||||||
|
Ok(pending_transaction) => pending_transaction,
|
||||||
|
Err(error) => {
|
||||||
|
let error_string = error.to_string();
|
||||||
|
|
||||||
|
if error_string.contains("Transaction Already Imported") {
|
||||||
|
PendingTransactionBuilder::<N>::new(provider.root().clone(), tx_hash)
|
||||||
|
} else {
|
||||||
|
return Err(error).context(format!("Failed to submit transaction {tx_hash}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
debug!(%tx_hash, "Submitted Transaction");
|
||||||
|
|
||||||
|
pending_transaction.set_timeout(Some(Duration::from_secs(120)));
|
||||||
|
let tx_hash = pending_transaction.watch().await.context(format!(
|
||||||
|
"Transaction inclusion watching timeout for {tx_hash}"
|
||||||
|
))?;
|
||||||
|
|
||||||
|
poll(
|
||||||
|
Duration::from_secs(60),
|
||||||
|
PollingWaitBehavior::Constant(Duration::from_secs(3)),
|
||||||
|
|| {
|
||||||
|
let provider = provider.clone();
|
||||||
|
|
||||||
|
async move {
|
||||||
|
match provider.get_transaction_receipt(tx_hash).await {
|
||||||
|
Ok(Some(receipt)) => Ok(ControlFlow::Break(receipt)),
|
||||||
|
_ => Ok(ControlFlow::Continue(())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.context(format!("Polling for receipt failed for {tx_hash}"))
|
||||||
|
}
|
||||||
|
|||||||
+3
-4
@@ -76,8 +76,6 @@ cat > "$CORPUS_FILE" << EOF
|
|||||||
{
|
{
|
||||||
"name": "MatterLabs Solidity Simple, Complex, and Semantic Tests",
|
"name": "MatterLabs Solidity Simple, Complex, and Semantic Tests",
|
||||||
"paths": [
|
"paths": [
|
||||||
"$(realpath "$TEST_REPO_DIR/fixtures/solidity/translated_semantic_tests")",
|
|
||||||
"$(realpath "$TEST_REPO_DIR/fixtures/solidity/complex")",
|
|
||||||
"$(realpath "$TEST_REPO_DIR/fixtures/solidity/simple")"
|
"$(realpath "$TEST_REPO_DIR/fixtures/solidity/simple")"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -95,11 +93,12 @@ echo ""
|
|||||||
# Run the tool
|
# Run the tool
|
||||||
cargo build --release;
|
cargo build --release;
|
||||||
RUST_LOG="info,alloy_pubsub::service=error" ./target/release/retester test \
|
RUST_LOG="info,alloy_pubsub::service=error" ./target/release/retester test \
|
||||||
--platform geth-evm-solc \
|
|
||||||
--platform revive-dev-node-revm-solc \
|
--platform revive-dev-node-revm-solc \
|
||||||
--corpus "$CORPUS_FILE" \
|
--corpus "$CORPUS_FILE" \
|
||||||
--working-directory "$WORKDIR" \
|
--working-directory "$WORKDIR" \
|
||||||
--concurrency.number-of-nodes 5 \
|
--concurrency.number-of-nodes 10 \
|
||||||
|
--concurrency.number-of-threads 5 \
|
||||||
|
--concurrency.number-of-concurrent-tasks 1000 \
|
||||||
--wallet.additional-keys 100000 \
|
--wallet.additional-keys 100000 \
|
||||||
--kitchensink.path "$SUBSTRATE_NODE_BIN" \
|
--kitchensink.path "$SUBSTRATE_NODE_BIN" \
|
||||||
--revive-dev-node.path "$REVIVE_DEV_NODE_BIN" \
|
--revive-dev-node.path "$REVIVE_DEV_NODE_BIN" \
|
||||||
|
|||||||
Reference in New Issue
Block a user