Replace infra with the dyn infra

This commit is contained in:
Omar Abdulla
2025-09-18 19:59:52 +03:00
parent 92fc7894c0
commit 496bc9a0ec
21 changed files with 556 additions and 693 deletions
+14 -21
View File
@@ -432,6 +432,14 @@ impl SubstrateNode {
}
impl EthereumNode for SubstrateNode {
fn id(&self) -> usize {
self.id as _
}
fn connection_string(&self) -> &str {
&self.rpc_url
}
fn execute_transaction(
&self,
transaction: alloy::rpc::types::TransactionRequest,
@@ -520,13 +528,17 @@ impl EthereumNode for SubstrateNode {
fn resolver(
&self,
) -> Pin<Box<dyn Future<Output = anyhow::Result<Box<dyn ResolverApi + '_>>> + '_>> {
) -> Pin<Box<dyn Future<Output = anyhow::Result<Arc<dyn ResolverApi + '_>>> + '_>> {
Box::pin(async move {
let id = self.id;
let provider = self.provider().await?;
Ok(Box::new(SubstrateNodeResolver { id, provider }) as Box<dyn ResolverApi>)
Ok(Arc::new(SubstrateNodeResolver { id, provider }) as Arc<dyn ResolverApi>)
})
}
fn evm_version(&self) -> EVMVersion {
EVMVersion::Cancun
}
}
pub struct SubstrateNodeResolver<F: TxFiller<ReviveNetwork>, P: Provider<ReviveNetwork>> {
@@ -803,14 +815,6 @@ impl ResolverApi for SubstrateNode {
}
impl Node for SubstrateNode {
fn id(&self) -> usize {
self.id as _
}
fn connection_string(&self) -> String {
self.rpc_url.clone()
}
fn shutdown(&mut self) -> anyhow::Result<()> {
// Terminate the processes in a graceful manner to allow for the output to be flushed.
if let Some(mut child) = self.process_proxy.take() {
@@ -854,17 +858,6 @@ impl Node for SubstrateNode {
.stdout;
Ok(String::from_utf8_lossy(&output).into())
}
fn matches_target(targets: Option<&[String]>) -> bool {
match targets {
None => true,
Some(targets) => targets.iter().any(|str| str.as_str() == "pvm"),
}
}
fn evm_version() -> EVMVersion {
EVMVersion::Cancun
}
}
impl Drop for SubstrateNode {