mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-14 04:01:07 +00:00
Fix the lighthouse node tracing issue
This commit is contained in:
+2
-1
@@ -80,8 +80,9 @@ default-features = false
|
|||||||
features = [
|
features = [
|
||||||
"json-abi",
|
"json-abi",
|
||||||
"providers",
|
"providers",
|
||||||
"provider-ipc",
|
|
||||||
"provider-ws",
|
"provider-ws",
|
||||||
|
"provider-ipc",
|
||||||
|
"provider-http",
|
||||||
"provider-debug-api",
|
"provider-debug-api",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rpc-types",
|
"rpc-types",
|
||||||
|
|||||||
@@ -35,16 +35,19 @@ use alloy::{
|
|||||||
ext::DebugApi,
|
ext::DebugApi,
|
||||||
fillers::{CachedNonceManager, ChainIdFiller, FillProvider, NonceFiller, TxFiller},
|
fillers::{CachedNonceManager, ChainIdFiller, FillProvider, NonceFiller, TxFiller},
|
||||||
},
|
},
|
||||||
rpc::types::{
|
rpc::{
|
||||||
EIP1186AccountProofResponse, TransactionRequest,
|
client::{BuiltInConnectionString, ClientBuilder, RpcClient},
|
||||||
trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame},
|
types::{
|
||||||
|
EIP1186AccountProofResponse, TransactionRequest,
|
||||||
|
trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
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 tracing::{Instrument, instrument};
|
use tracing::{Instrument, info, instrument};
|
||||||
|
|
||||||
use revive_dt_common::{
|
use revive_dt_common::{
|
||||||
fs::clear_directory,
|
fs::clear_directory,
|
||||||
@@ -75,7 +78,8 @@ static NODE_COUNT: AtomicU32 = AtomicU32::new(0);
|
|||||||
pub struct LighthouseGethNode {
|
pub struct LighthouseGethNode {
|
||||||
/* Node Identifier */
|
/* Node Identifier */
|
||||||
id: u32,
|
id: u32,
|
||||||
connection_string: String,
|
ws_connection_string: String,
|
||||||
|
http_connection_string: String,
|
||||||
enclave_name: String,
|
enclave_name: String,
|
||||||
|
|
||||||
/* Directory Paths */
|
/* Directory Paths */
|
||||||
@@ -104,7 +108,6 @@ impl LighthouseGethNode {
|
|||||||
const BASE_DIRECTORY: &str = "lighthouse";
|
const BASE_DIRECTORY: &str = "lighthouse";
|
||||||
const LOGS_DIRECTORY: &str = "logs";
|
const LOGS_DIRECTORY: &str = "logs";
|
||||||
|
|
||||||
const IPC_FILE_NAME: &str = "geth.ipc";
|
|
||||||
const CONFIG_FILE_NAME: &str = "config.yaml";
|
const CONFIG_FILE_NAME: &str = "config.yaml";
|
||||||
|
|
||||||
const TRANSACTION_INDEXING_ERROR: &str = "transaction indexing is in progress";
|
const TRANSACTION_INDEXING_ERROR: &str = "transaction indexing is in progress";
|
||||||
@@ -137,10 +140,8 @@ impl LighthouseGethNode {
|
|||||||
Self {
|
Self {
|
||||||
/* Node Identifier */
|
/* Node Identifier */
|
||||||
id,
|
id,
|
||||||
connection_string: base_directory
|
ws_connection_string: String::default(),
|
||||||
.join(Self::IPC_FILE_NAME)
|
http_connection_string: String::default(),
|
||||||
.display()
|
|
||||||
.to_string(),
|
|
||||||
enclave_name: format!(
|
enclave_name: format!(
|
||||||
"enclave-{}-{}",
|
"enclave-{}-{}",
|
||||||
SystemTime::now()
|
SystemTime::now()
|
||||||
@@ -316,28 +317,75 @@ impl LighthouseGethNode {
|
|||||||
stdout
|
stdout
|
||||||
};
|
};
|
||||||
|
|
||||||
self.connection_string = stdout
|
self.http_connection_string = stdout
|
||||||
|
.split("el-1-geth-lighthouse")
|
||||||
|
.nth(1)
|
||||||
|
.and_then(|str| str.split(" rpc").nth(1))
|
||||||
|
.and_then(|str| str.split("->").nth(1))
|
||||||
|
.and_then(|str| str.split("\n").next())
|
||||||
|
.and_then(|str| str.trim().split(" ").next())
|
||||||
|
.map(|str| format!("http://{}", str.trim()))
|
||||||
|
.context("Failed to find the HTTP connection string of Kurtosis")?;
|
||||||
|
self.ws_connection_string = stdout
|
||||||
.split("el-1-geth-lighthouse")
|
.split("el-1-geth-lighthouse")
|
||||||
.nth(1)
|
.nth(1)
|
||||||
.and_then(|str| str.split("ws").nth(1))
|
.and_then(|str| str.split("ws").nth(1))
|
||||||
.and_then(|str| str.split("->").nth(1))
|
.and_then(|str| str.split("->").nth(1))
|
||||||
.and_then(|str| str.split("\n").next())
|
.and_then(|str| str.split("\n").next())
|
||||||
|
.and_then(|str| str.trim().split(" ").next())
|
||||||
.map(|str| format!("ws://{}", str.trim()))
|
.map(|str| format!("ws://{}", str.trim()))
|
||||||
.context("Failed to find the WS connection string of Kurtosis")?;
|
.context("Failed to find the WS connection string of Kurtosis")?;
|
||||||
|
|
||||||
|
info!(
|
||||||
|
http_connection_string = self.http_connection_string,
|
||||||
|
ws_connection_string = self.ws_connection_string,
|
||||||
|
"Discovered the connection strings for the node"
|
||||||
|
);
|
||||||
|
|
||||||
Ok(self)
|
Ok(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(
|
#[instrument(
|
||||||
level = "info",
|
level = "info",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(lighthouse_node_id = self.id, connection_string = self.connection_string),
|
fields(lighthouse_node_id = self.id, connection_string = self.ws_connection_string),
|
||||||
err(Debug),
|
err(Debug),
|
||||||
)]
|
)]
|
||||||
async fn provider(
|
async fn ws_provider(
|
||||||
&self,
|
&self,
|
||||||
) -> anyhow::Result<FillProvider<impl TxFiller<Ethereum>, impl Provider<Ethereum>, Ethereum>>
|
) -> anyhow::Result<FillProvider<impl TxFiller<Ethereum>, impl Provider<Ethereum>, Ethereum>>
|
||||||
{
|
{
|
||||||
|
let client = ClientBuilder::default()
|
||||||
|
.connect_with(BuiltInConnectionString::Ws(
|
||||||
|
self.ws_connection_string.as_str().parse().unwrap(),
|
||||||
|
None,
|
||||||
|
))
|
||||||
|
.await?;
|
||||||
|
Ok(self.provider(client))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[instrument(
|
||||||
|
level = "info",
|
||||||
|
skip_all,
|
||||||
|
fields(lighthouse_node_id = self.id, connection_string = self.ws_connection_string),
|
||||||
|
err(Debug),
|
||||||
|
)]
|
||||||
|
async fn http_provider(
|
||||||
|
&self,
|
||||||
|
) -> anyhow::Result<FillProvider<impl TxFiller<Ethereum>, impl Provider<Ethereum>, Ethereum>>
|
||||||
|
{
|
||||||
|
let client = ClientBuilder::default()
|
||||||
|
.connect_with(BuiltInConnectionString::Http(
|
||||||
|
self.http_connection_string.as_str().parse().unwrap(),
|
||||||
|
))
|
||||||
|
.await?;
|
||||||
|
Ok(self.provider(client))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn provider(
|
||||||
|
&self,
|
||||||
|
rpc_client: RpcClient,
|
||||||
|
) -> FillProvider<impl TxFiller<Ethereum>, impl Provider<Ethereum>, Ethereum> {
|
||||||
ProviderBuilder::new()
|
ProviderBuilder::new()
|
||||||
.disable_recommended_fillers()
|
.disable_recommended_fillers()
|
||||||
.filler(FallbackGasFiller::new(
|
.filler(FallbackGasFiller::new(
|
||||||
@@ -348,21 +396,19 @@ impl LighthouseGethNode {
|
|||||||
.filler(self.chain_id_filler.clone())
|
.filler(self.chain_id_filler.clone())
|
||||||
.filler(NonceFiller::new(self.nonce_manager.clone()))
|
.filler(NonceFiller::new(self.nonce_manager.clone()))
|
||||||
.wallet(self.wallet.clone())
|
.wallet(self.wallet.clone())
|
||||||
.connect(&self.connection_string)
|
.connect_client(rpc_client)
|
||||||
.await
|
|
||||||
.context("Failed to create the provider for Kurtosis")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Funds all of the accounts in the Ethereum wallet from the initially funded account.
|
/// Funds all of the accounts in the Ethereum wallet from the initially funded account.
|
||||||
#[instrument(
|
#[instrument(
|
||||||
level = "info",
|
level = "info",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(lighthouse_node_id = self.id, connection_string = self.connection_string),
|
fields(lighthouse_node_id = self.id, connection_string = self.ws_connection_string),
|
||||||
err(Debug),
|
err(Debug),
|
||||||
)]
|
)]
|
||||||
async fn fund_all_accounts(&self) -> anyhow::Result<()> {
|
async fn fund_all_accounts(&self) -> anyhow::Result<()> {
|
||||||
let mut providers =
|
let mut providers =
|
||||||
futures::future::try_join_all((0..100).map(|_| self.provider()).collect::<Vec<_>>())
|
futures::future::try_join_all((0..100).map(|_| self.ws_provider()).collect::<Vec<_>>())
|
||||||
.await
|
.await
|
||||||
.context("Failed to create the providers")?
|
.context("Failed to create the providers")?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -407,6 +453,13 @@ impl LighthouseGethNode {
|
|||||||
tx_hashes.remove(hash);
|
tx_hashes.remove(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info!(
|
||||||
|
block.number = block_number,
|
||||||
|
block.timestamp = block.header.timestamp,
|
||||||
|
remaining_transactions = tx_hashes.len(),
|
||||||
|
"Discovered new block in funding accounts"
|
||||||
|
);
|
||||||
|
|
||||||
block_number += 1
|
block_number += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,13 +543,13 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn connection_string(&self) -> &str {
|
fn connection_string(&self) -> &str {
|
||||||
&self.connection_string
|
&self.ws_connection_string
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(
|
#[instrument(
|
||||||
level = "info",
|
level = "info",
|
||||||
skip_all,
|
skip_all,
|
||||||
fields(lighthouse_node_id = self.id, connection_string = self.connection_string),
|
fields(lighthouse_node_id = self.id, connection_string = self.ws_connection_string),
|
||||||
err,
|
err,
|
||||||
)]
|
)]
|
||||||
fn execute_transaction(
|
fn execute_transaction(
|
||||||
@@ -506,7 +559,7 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
{
|
{
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let provider = self
|
let provider = self
|
||||||
.provider()
|
.ws_provider()
|
||||||
.await
|
.await
|
||||||
.map(Arc::new)
|
.map(Arc::new)
|
||||||
.context("Failed to create provider for transaction submission")?;
|
.context("Failed to create provider for transaction submission")?;
|
||||||
@@ -523,7 +576,7 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
{
|
{
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let provider = Arc::new(
|
let provider = Arc::new(
|
||||||
self.provider()
|
self.http_provider()
|
||||||
.await
|
.await
|
||||||
.context("Failed to create provider for tracing")?,
|
.context("Failed to create provider for tracing")?,
|
||||||
);
|
);
|
||||||
@@ -584,7 +637,7 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
address: Address,
|
address: Address,
|
||||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<U256>> + '_>> {
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<U256>> + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
self.provider()
|
self.ws_provider()
|
||||||
.await
|
.await
|
||||||
.context("Failed to get the Geth provider")?
|
.context("Failed to get the Geth provider")?
|
||||||
.get_balance(address)
|
.get_balance(address)
|
||||||
@@ -600,7 +653,7 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
keys: Vec<StorageKey>,
|
keys: Vec<StorageKey>,
|
||||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<EIP1186AccountProofResponse>> + '_>> {
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<EIP1186AccountProofResponse>> + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
self.provider()
|
self.ws_provider()
|
||||||
.await
|
.await
|
||||||
.context("Failed to get the Geth provider")?
|
.context("Failed to get the Geth provider")?
|
||||||
.get_proof(address, keys)
|
.get_proof(address, keys)
|
||||||
@@ -616,7 +669,7 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
) -> Pin<Box<dyn Future<Output = anyhow::Result<Arc<dyn ResolverApi + '_>>> + '_>> {
|
) -> Pin<Box<dyn Future<Output = anyhow::Result<Arc<dyn ResolverApi + '_>>> + '_>> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let id = self.id;
|
let id = self.id;
|
||||||
let provider = self.provider().await?;
|
let provider = self.ws_provider().await?;
|
||||||
Ok(Arc::new(LighthouseGethNodeResolver { id, provider }) as Arc<dyn ResolverApi>)
|
Ok(Arc::new(LighthouseGethNodeResolver { id, provider }) as Arc<dyn ResolverApi>)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -89,12 +89,13 @@ echo "This may take a while..."
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Run the tool
|
# Run the tool
|
||||||
RUST_LOG="info" cargo run --release -- execute-tests \
|
RUST_LOG="info,alloy_pubsub::service=error" cargo run --release -- execute-tests \
|
||||||
--platform geth-evm-solc \
|
--platform geth-evm-solc \
|
||||||
--platform lighthouse-geth-evm-solc \
|
--platform lighthouse-geth-evm-solc \
|
||||||
--corpus "$CORPUS_FILE" \
|
--corpus "$CORPUS_FILE" \
|
||||||
--working-directory "$WORKDIR" \
|
--working-directory "$WORKDIR" \
|
||||||
--concurrency.number-of-nodes 5 \
|
--concurrency.number-of-nodes 3 \
|
||||||
|
--wallet.additional-keys 10000 \
|
||||||
--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" \
|
||||||
--eth-rpc.path "$ETH_RPC_BIN" \
|
--eth-rpc.path "$ETH_RPC_BIN" \
|
||||||
|
|||||||
Reference in New Issue
Block a user