Fix conficts with main

This commit is contained in:
Marios Christou
2025-10-06 09:52:12 +03:00
parent bd5a901c65
commit 97d45258ca
6 changed files with 2242 additions and 114 deletions
Generated
+2126 -57
View File
File diff suppressed because it is too large Load Diff
+12 -1
View File
@@ -110,7 +110,8 @@ impl AsRef<KurtosisConfiguration> for Context {
impl AsRef<ZombienetConfiguration> for Context { impl AsRef<ZombienetConfiguration> for Context {
fn as_ref(&self) -> &ZombienetConfiguration { fn as_ref(&self) -> &ZombienetConfiguration {
match self { match self {
Self::ExecuteTests(context) => context.as_ref().as_ref(), Self::Test(context) => context.as_ref().as_ref(),
Self::Benchmark(context) => context.as_ref().as_ref(),
Self::ExportJsonSchema => unreachable!(), Self::ExportJsonSchema => unreachable!(),
} }
} }
@@ -331,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 Zombienet.
#[clap(flatten, next_help_heading = "Zombienet Configuration")]
pub zombienet_configuration: ZombienetConfiguration,
/// 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,
@@ -494,6 +499,12 @@ impl AsRef<KurtosisConfiguration> for BenchmarkingContext {
} }
} }
impl AsRef<ZombienetConfiguration> for BenchmarkingContext {
fn as_ref(&self) -> &ZombienetConfiguration {
&self.zombienet_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
+1 -3
View File
@@ -14,11 +14,9 @@ use revive_dt_common::types::*;
use revive_dt_compiler::{SolidityCompiler, revive_resolc::Resolc, solc::Solc}; use revive_dt_compiler::{SolidityCompiler, revive_resolc::Resolc, solc::Solc};
use revive_dt_config::*; use revive_dt_config::*;
use revive_dt_node::{ use revive_dt_node::{
Node, geth::GethNode, lighthouse_geth::LighthouseGethNode, substrate::SubstrateNode,
zombie::ZombieNode,
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;
-5
View File
@@ -4,11 +4,6 @@ use alloy::genesis::Genesis;
use revive_dt_node_interaction::EthereumNode; use revive_dt_node_interaction::EthereumNode;
pub mod constants; pub mod constants;
pub mod geth;
pub mod lighthouse_geth;
pub mod process;
pub mod substrate;
pub mod zombie;
pub mod helpers; pub mod helpers;
pub mod node_implementations; pub mod node_implementations;
pub mod provider_utils; pub mod provider_utils;
@@ -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;
@@ -44,25 +44,25 @@ use alloy::{
network::{Ethereum, EthereumWallet, NetworkWallet}, network::{Ethereum, EthereumWallet, NetworkWallet},
primitives::{Address, BlockHash, BlockNumber, BlockTimestamp, StorageKey, TxHash, U256}, primitives::{Address, BlockHash, BlockNumber, BlockTimestamp, StorageKey, TxHash, U256},
providers::{ providers::{
Identity, Provider, ProviderBuilder, RootProvider, Provider,
ext::DebugApi, ext::DebugApi,
fillers::{ fillers::{
CachedNonceManager, ChainIdFiller, FillProvider, JoinFill, NonceFiller, TxFiller, CachedNonceManager, ChainIdFiller, FillProvider, NonceFiller, TxFiller,
WalletFiller,
}, },
}, },
rpc::types::{ rpc::types::{
EIP1186AccountProofResponse, TransactionReceipt, EIP1186AccountProofResponse, TransactionReceipt,TransactionRequest,
trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame}, trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame},
}, },
}; };
use anyhow::Context as _; use anyhow::Context as _;
use futures::{Stream, StreamExt};
use revive_common::EVMVersion; use revive_common::EVMVersion;
use revive_dt_common::fs::clear_directory; use revive_dt_common::fs::clear_directory;
use revive_dt_config::*; use revive_dt_config::*;
use revive_dt_format::traits::ResolverApi; use revive_dt_format::traits::ResolverApi;
use revive_dt_node_interaction::EthereumNode; use revive_dt_node_interaction::{EthereumNode, MinedBlockInformation};
use serde_json::{Value as JsonValue, json}; use serde_json::{Value as JsonValue, json};
use sp_core::crypto::Ss58Codec; use sp_core::crypto::Ss58Codec;
use sp_runtime::AccountId32; use sp_runtime::AccountId32;
@@ -72,10 +72,10 @@ use zombienet_sdk::{LocalFileSystem, NetworkConfigBuilder, NetworkConfigExt};
use crate::{ use crate::{
Node, Node,
common::FallbackGasFiller, constants::{CHAIN_ID, INITIAL_BALANCE},
constants::INITIAL_BALANCE, helpers::{Process, ProcessReadinessWaitBehavior},
process::{Process, ProcessReadinessWaitBehavior}, provider_utils::{ConcreteProvider, FallbackGasFiller, construct_concurrency_limited_provider},
substrate::ReviveNetwork, node_implementations::substrate::ReviveNetwork,
}; };
static NODE_COUNT: AtomicU32 = AtomicU32::new(0); static NODE_COUNT: AtomicU32 = AtomicU32::new(0);
@@ -93,25 +93,11 @@ pub struct ZombieNode {
eth_proxy_binary: PathBuf, eth_proxy_binary: PathBuf,
wallet: Arc<EthereumWallet>, wallet: Arc<EthereumWallet>,
nonce_manager: CachedNonceManager, nonce_manager: CachedNonceManager,
chain_id_filler: ChainIdFiller,
network_config: Option<zombienet_sdk::NetworkConfig>, network_config: Option<zombienet_sdk::NetworkConfig>,
network: Option<zombienet_sdk::Network<LocalFileSystem>>, network: Option<zombienet_sdk::Network<LocalFileSystem>>,
eth_rpc_process: Option<Process>, eth_rpc_process: Option<Process>,
node_rpc_port: Option<u16>, node_rpc_port: Option<u16>,
#[allow(clippy::type_complexity)] provider: OnceCell<ConcreteProvider<ReviveNetwork, Arc<EthereumWallet>>>,
provider: OnceCell<
FillProvider<
JoinFill<
JoinFill<
JoinFill<JoinFill<Identity, FallbackGasFiller>, ChainIdFiller>,
NonceFiller,
>,
WalletFiller<Arc<EthereumWallet>>,
>,
RootProvider<ReviveNetwork>,
ReviveNetwork,
>,
>,
} }
impl ZombieNode { impl ZombieNode {
@@ -153,7 +139,6 @@ impl ZombieNode {
node_binary: node_path, node_binary: node_path,
eth_proxy_binary, eth_proxy_binary,
nonce_manager: CachedNonceManager::default(), nonce_manager: CachedNonceManager::default(),
chain_id_filler: ChainIdFiller::default(),
network_config: None, network_config: None,
network: None, network: None,
eth_rpc_process: None, eth_rpc_process: None,
@@ -253,6 +238,8 @@ impl ZombieNode {
}, },
); );
match eth_rpc_process { match eth_rpc_process {
Ok(process) => self.eth_rpc_process = Some(process), Ok(process) => self.eth_rpc_process = Some(process),
Err(err) => { Err(err) => {
@@ -382,31 +369,20 @@ impl ZombieNode {
Ok(String::from_utf8_lossy(&output).trim().to_string()) Ok(String::from_utf8_lossy(&output).trim().to_string())
} }
async fn provider( async fn provider(
&self, &self,
) -> anyhow::Result< ) -> anyhow::Result<ConcreteProvider<ReviveNetwork, Arc<EthereumWallet>>> {
FillProvider<
impl TxFiller<ReviveNetwork>,
impl Provider<ReviveNetwork> + Clone,
ReviveNetwork,
>,
> {
self.provider self.provider
.get_or_try_init(|| async move { .get_or_try_init(|| async move {
ProviderBuilder::new() construct_concurrency_limited_provider::<ReviveNetwork, _>(
.disable_recommended_fillers() self.connection_string.as_str(),
.network::<ReviveNetwork>() FallbackGasFiller::new(250_000_000, 5_000_000_000, 1_000_000_000),
.filler(FallbackGasFiller::new( ChainIdFiller::new(Some(CHAIN_ID)),
1_000_000_000, NonceFiller::new(self.nonce_manager.clone()),
1_000_000_000, self.wallet.clone(),
1_000_000_000, )
)) .await
.filler(self.chain_id_filler.clone()) .context("Failed to construct the provider")
.filler(NonceFiller::new(self.nonce_manager.clone()))
.wallet(self.wallet.clone())
.connect(&self.connection_string)
.await
.map_err(Into::into)
}) })
.await .await
.cloned() .cloned()
@@ -414,6 +390,10 @@ impl ZombieNode {
} }
impl EthereumNode for ZombieNode { impl EthereumNode for ZombieNode {
fn pre_transactions(&mut self) -> Pin<Box<dyn Future<Output = anyhow::Result<()>> + '_>> {
Box::pin(async move { Ok(()) })
}
fn id(&self) -> usize { fn id(&self) -> usize {
self.id as _ self.id as _
} }
@@ -422,6 +402,38 @@ impl EthereumNode for ZombieNode {
&self.connection_string &self.connection_string
} }
fn submit_transaction(
&self,
transaction: TransactionRequest,
) -> Pin<Box<dyn Future<Output = anyhow::Result<TxHash>> + '_>> {
Box::pin(async move {
let provider = self
.provider()
.await
.context("Failed to create the provider for transaction submission")?;
let pending_transaction = provider
.send_transaction(transaction)
.await
.context("Failed to submit the transaction through the provider")?;
Ok(*pending_transaction.tx_hash())
})
}
fn get_receipt(
&self,
tx_hash: TxHash,
) -> Pin<Box<dyn Future<Output = anyhow::Result<TransactionReceipt>> + '_>> {
Box::pin(async move {
self.provider()
.await
.context("Failed to create provider for getting the receipt")?
.get_transaction_receipt(tx_hash)
.await
.context("Failed to get the receipt of the transaction")?
.context("Failed to get the receipt of the transaction")
})
}
fn execute_transaction( fn execute_transaction(
&self, &self,
transaction: alloy::rpc::types::TransactionRequest, transaction: alloy::rpc::types::TransactionRequest,
@@ -522,6 +534,48 @@ impl EthereumNode for ZombieNode {
fn evm_version(&self) -> EVMVersion { fn evm_version(&self) -> EVMVersion {
EVMVersion::Cancun EVMVersion::Cancun
} }
fn subscribe_to_full_blocks_information(
&self,
) -> Pin<
Box<
dyn Future<Output = anyhow::Result<Pin<Box<dyn Stream<Item = MinedBlockInformation>>>>>
+ '_,
>,
> {
Box::pin(async move {
let provider = self
.provider()
.await
.context("Failed to create the provider for block subscription")?;
let mut block_subscription = provider
.watch_full_blocks()
.await
.context("Failed to create the blocks stream")?;
block_subscription.set_channel_size(0xFFFF);
block_subscription.set_poll_interval(Duration::from_secs(1));
let block_stream = block_subscription.into_stream();
let mined_block_information_stream = block_stream.filter_map(|block| async {
let block = block.ok()?;
Some(MinedBlockInformation {
block_number: block.number(),
block_timestamp: block.header.timestamp,
mined_gas: block.header.gas_used as _,
block_gas_limit: block.header.gas_limit,
transaction_hashes: block
.transactions
.into_hashes()
.as_hashes()
.expect("Must be hashes")
.to_vec(),
})
});
Ok(Box::pin(mined_block_information_stream)
as Pin<Box<dyn Stream<Item = MinedBlockInformation>>>)
})
}
} }
pub struct ZombieNodeResolver<F: TxFiller<ReviveNetwork>, P: Provider<ReviveNetwork>> { pub struct ZombieNodeResolver<F: TxFiller<ReviveNetwork>, P: Provider<ReviveNetwork>> {
@@ -709,7 +763,7 @@ impl Drop for ZombieNode {
mod tests { mod tests {
use alloy::rpc::types::TransactionRequest; use alloy::rpc::types::TransactionRequest;
use crate::zombie::tests::utils::shared_node; use crate::node_implementations::zombienet::tests::utils::shared_node;
use super::*; use super::*;