mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-20 23:11:05 +00:00
Modify the structure of the MinedBlockInformation
This commit is contained in:
@@ -113,7 +113,7 @@ impl Watcher {
|
|||||||
while let Some(block) = blocks_information_stream.next().await {
|
while let Some(block) = blocks_information_stream.next().await {
|
||||||
// If the block number is equal to or less than the last block before the
|
// If the block number is equal to or less than the last block before the
|
||||||
// repetition then we ignore it and continue on to the next block.
|
// repetition then we ignore it and continue on to the next block.
|
||||||
if block.block_number <= ignore_block_before {
|
if block.ethereum_block_information.block_number <= ignore_block_before {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,8 +124,8 @@ impl Watcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
block_number = block.block_number,
|
block_number = block.ethereum_block_information.block_number,
|
||||||
block_tx_count = block.transaction_hashes.len(),
|
block_tx_count = block.ethereum_block_information.transaction_hashes.len(),
|
||||||
remaining_transactions = watch_for_transaction_hashes.read().await.len(),
|
remaining_transactions = watch_for_transaction_hashes.read().await.len(),
|
||||||
"Observed a block"
|
"Observed a block"
|
||||||
);
|
);
|
||||||
@@ -134,7 +134,7 @@ impl Watcher {
|
|||||||
// are currently watching for.
|
// are currently watching for.
|
||||||
let mut watch_for_transaction_hashes =
|
let mut watch_for_transaction_hashes =
|
||||||
watch_for_transaction_hashes.write().await;
|
watch_for_transaction_hashes.write().await;
|
||||||
for tx_hash in block.transaction_hashes.iter() {
|
for tx_hash in block.ethereum_block_information.transaction_hashes.iter() {
|
||||||
watch_for_transaction_hashes.remove(tx_hash);
|
watch_for_transaction_hashes.remove(tx_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,16 +143,28 @@ impl Watcher {
|
|||||||
// reporting in place and then it can be removed. This serves as as way of doing
|
// reporting in place and then it can be removed. This serves as as way of doing
|
||||||
// some very simple reporting for the time being.
|
// some very simple reporting for the time being.
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{}\"",
|
"\"{}\",\"{}\",\"{}\",\"{}\",\"{}\",\"{:?}\",\"{:?}\",\"{:?}\",\"{:?}\"",
|
||||||
block.block_number,
|
block.ethereum_block_information.block_number,
|
||||||
block.block_timestamp,
|
block.ethereum_block_information.block_timestamp,
|
||||||
block.mined_gas,
|
block.ethereum_block_information.mined_gas,
|
||||||
block.block_gas_limit,
|
block.ethereum_block_information.block_gas_limit,
|
||||||
block.transaction_hashes.len(),
|
block.ethereum_block_information.transaction_hashes.len(),
|
||||||
block.ref_time,
|
block
|
||||||
block.max_ref_time,
|
.substrate_block_information
|
||||||
block.proof_size,
|
.as_ref()
|
||||||
block.max_proof_size,
|
.map(|block| block.ref_time),
|
||||||
|
block
|
||||||
|
.substrate_block_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|block| block.max_ref_time),
|
||||||
|
block
|
||||||
|
.substrate_block_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|block| block.proof_size),
|
||||||
|
block
|
||||||
|
.substrate_block_information
|
||||||
|
.as_ref()
|
||||||
|
.map(|block| block.max_proof_size),
|
||||||
);
|
);
|
||||||
// endregion:TEMPORARY
|
// endregion:TEMPORARY
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ pub trait EthereumNode {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct MinedBlockInformation {
|
pub struct MinedBlockInformation {
|
||||||
|
pub ethereum_block_information: EthereumMinedBlockInformation,
|
||||||
|
pub substrate_block_information: Option<SubstrateMinedBlockInformation>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub struct EthereumMinedBlockInformation {
|
||||||
/// The block number.
|
/// The block number.
|
||||||
pub block_number: BlockNumber,
|
pub block_number: BlockNumber,
|
||||||
|
|
||||||
@@ -97,7 +103,10 @@ pub struct MinedBlockInformation {
|
|||||||
|
|
||||||
/// The hashes of the transactions that were mined as part of the block.
|
/// The hashes of the transactions that were mined as part of the block.
|
||||||
pub transaction_hashes: Vec<TxHash>,
|
pub transaction_hashes: Vec<TxHash>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub struct SubstrateMinedBlockInformation {
|
||||||
/// The ref time for substrate based chains.
|
/// The ref time for substrate based chains.
|
||||||
pub ref_time: u128,
|
pub ref_time: u128,
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ use revive_dt_common::{
|
|||||||
};
|
};
|
||||||
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, MinedBlockInformation};
|
use revive_dt_node_interaction::{
|
||||||
|
EthereumMinedBlockInformation, EthereumNode, MinedBlockInformation,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Node,
|
Node,
|
||||||
@@ -526,20 +528,19 @@ impl EthereumNode for GethNode {
|
|||||||
let mined_block_information_stream = block_stream.filter_map(|block| async {
|
let mined_block_information_stream = block_stream.filter_map(|block| async {
|
||||||
let block = block.ok()?;
|
let block = block.ok()?;
|
||||||
Some(MinedBlockInformation {
|
Some(MinedBlockInformation {
|
||||||
block_number: block.number(),
|
ethereum_block_information: EthereumMinedBlockInformation {
|
||||||
block_timestamp: block.header.timestamp,
|
block_number: block.number(),
|
||||||
mined_gas: block.header.gas_used as _,
|
block_timestamp: block.header.timestamp,
|
||||||
block_gas_limit: block.header.gas_limit as _,
|
mined_gas: block.header.gas_used as _,
|
||||||
transaction_hashes: block
|
block_gas_limit: block.header.gas_limit as _,
|
||||||
.transactions
|
transaction_hashes: block
|
||||||
.into_hashes()
|
.transactions
|
||||||
.as_hashes()
|
.into_hashes()
|
||||||
.expect("Must be hashes")
|
.as_hashes()
|
||||||
.to_vec(),
|
.expect("Must be hashes")
|
||||||
ref_time: 0,
|
.to_vec(),
|
||||||
max_ref_time: 0,
|
},
|
||||||
proof_size: 0,
|
substrate_block_information: None,
|
||||||
max_proof_size: 0,
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ use revive_dt_common::{
|
|||||||
};
|
};
|
||||||
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, MinedBlockInformation};
|
use revive_dt_node_interaction::{
|
||||||
|
EthereumMinedBlockInformation, EthereumNode, MinedBlockInformation,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Node,
|
Node,
|
||||||
@@ -757,20 +759,19 @@ impl EthereumNode for LighthouseGethNode {
|
|||||||
let mined_block_information_stream = block_stream.filter_map(|block| async {
|
let mined_block_information_stream = block_stream.filter_map(|block| async {
|
||||||
let block = block.ok()?;
|
let block = block.ok()?;
|
||||||
Some(MinedBlockInformation {
|
Some(MinedBlockInformation {
|
||||||
block_number: block.number(),
|
ethereum_block_information: EthereumMinedBlockInformation {
|
||||||
block_timestamp: block.header.timestamp,
|
block_number: block.number(),
|
||||||
mined_gas: block.header.gas_used as _,
|
block_timestamp: block.header.timestamp,
|
||||||
block_gas_limit: block.header.gas_limit as _,
|
mined_gas: block.header.gas_used as _,
|
||||||
transaction_hashes: block
|
block_gas_limit: block.header.gas_limit as _,
|
||||||
.transactions
|
transaction_hashes: block
|
||||||
.into_hashes()
|
.transactions
|
||||||
.as_hashes()
|
.into_hashes()
|
||||||
.expect("Must be hashes")
|
.as_hashes()
|
||||||
.to_vec(),
|
.expect("Must be hashes")
|
||||||
ref_time: 0,
|
.to_vec(),
|
||||||
max_ref_time: 0,
|
},
|
||||||
proof_size: 0,
|
substrate_block_information: None,
|
||||||
max_proof_size: 0,
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ use sp_core::crypto::Ss58Codec;
|
|||||||
use sp_runtime::AccountId32;
|
use sp_runtime::AccountId32;
|
||||||
|
|
||||||
use revive_dt_config::*;
|
use revive_dt_config::*;
|
||||||
use revive_dt_node_interaction::{EthereumNode, MinedBlockInformation};
|
use revive_dt_node_interaction::{
|
||||||
|
EthereumMinedBlockInformation, EthereumNode, MinedBlockInformation,
|
||||||
|
SubstrateMinedBlockInformation,
|
||||||
|
};
|
||||||
use subxt::{OnlineClient, SubstrateConfig};
|
use subxt::{OnlineClient, SubstrateConfig};
|
||||||
use tokio::sync::OnceCell;
|
use tokio::sync::OnceCell;
|
||||||
use tracing::{instrument, trace};
|
use tracing::{instrument, trace};
|
||||||
@@ -557,20 +560,24 @@ impl EthereumNode for SubstrateNode {
|
|||||||
let max_proof_size = limits.max_block.proof_size;
|
let max_proof_size = limits.max_block.proof_size;
|
||||||
|
|
||||||
Some(MinedBlockInformation {
|
Some(MinedBlockInformation {
|
||||||
block_number: substrate_block.number() as _,
|
ethereum_block_information: EthereumMinedBlockInformation {
|
||||||
block_timestamp: revive_block.header.timestamp,
|
block_number: revive_block.number(),
|
||||||
mined_gas: revive_block.header.gas_used as _,
|
block_timestamp: revive_block.header.timestamp,
|
||||||
block_gas_limit: revive_block.header.gas_limit as _,
|
mined_gas: revive_block.header.gas_used as _,
|
||||||
transaction_hashes: revive_block
|
block_gas_limit: revive_block.header.gas_limit as _,
|
||||||
.transactions
|
transaction_hashes: revive_block
|
||||||
.into_hashes()
|
.transactions
|
||||||
.as_hashes()
|
.into_hashes()
|
||||||
.expect("Must be hashes")
|
.as_hashes()
|
||||||
.to_vec(),
|
.expect("Must be hashes")
|
||||||
ref_time: block_ref_time,
|
.to_vec(),
|
||||||
max_ref_time,
|
},
|
||||||
proof_size: block_proof_size,
|
substrate_block_information: Some(SubstrateMinedBlockInformation {
|
||||||
max_proof_size,
|
ref_time: block_ref_time,
|
||||||
|
max_ref_time,
|
||||||
|
proof_size: block_proof_size,
|
||||||
|
max_proof_size,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ 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, MinedBlockInformation};
|
use revive_dt_node_interaction::*;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use sp_core::crypto::Ss58Codec;
|
use sp_core::crypto::Ss58Codec;
|
||||||
use sp_runtime::AccountId32;
|
use sp_runtime::AccountId32;
|
||||||
@@ -578,20 +578,24 @@ impl EthereumNode for ZombienetNode {
|
|||||||
let max_proof_size = limits.max_block.proof_size;
|
let max_proof_size = limits.max_block.proof_size;
|
||||||
|
|
||||||
Some(MinedBlockInformation {
|
Some(MinedBlockInformation {
|
||||||
block_number: substrate_block.number() as _,
|
ethereum_block_information: EthereumMinedBlockInformation {
|
||||||
block_timestamp: revive_block.header.timestamp,
|
block_number: revive_block.number(),
|
||||||
mined_gas: revive_block.header.gas_used as _,
|
block_timestamp: revive_block.header.timestamp,
|
||||||
block_gas_limit: revive_block.header.gas_limit as _,
|
mined_gas: revive_block.header.gas_used as _,
|
||||||
transaction_hashes: revive_block
|
block_gas_limit: revive_block.header.gas_limit as _,
|
||||||
.transactions
|
transaction_hashes: revive_block
|
||||||
.into_hashes()
|
.transactions
|
||||||
.as_hashes()
|
.into_hashes()
|
||||||
.expect("Must be hashes")
|
.as_hashes()
|
||||||
.to_vec(),
|
.expect("Must be hashes")
|
||||||
ref_time: block_ref_time,
|
.to_vec(),
|
||||||
max_ref_time,
|
},
|
||||||
proof_size: block_proof_size,
|
substrate_block_information: Some(SubstrateMinedBlockInformation {
|
||||||
max_proof_size,
|
ref_time: block_ref_time,
|
||||||
|
max_ref_time,
|
||||||
|
proof_size: block_proof_size,
|
||||||
|
max_proof_size,
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user