mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-22 20:47:58 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e25a3ed8d | |||
| c389073ee3 | |||
| dc836a4072 |
@@ -1,11 +1,11 @@
|
|||||||
//! The test driver handles the compilation and execution of the test cases.
|
//! The test driver handles the compilation and execution of the test cases.
|
||||||
|
|
||||||
use alloy::json_abi::JsonAbi;
|
use alloy::json_abi::JsonAbi;
|
||||||
use alloy::primitives::Bytes;
|
use alloy::network::TransactionBuilder;
|
||||||
|
use alloy::rpc::types::TransactionReceipt;
|
||||||
use alloy::rpc::types::trace::geth::GethTrace;
|
use alloy::rpc::types::trace::geth::GethTrace;
|
||||||
use alloy::rpc::types::{TransactionInput, TransactionReceipt};
|
|
||||||
use alloy::{
|
use alloy::{
|
||||||
primitives::{Address, TxKind, map::HashMap},
|
primitives::{Address, map::HashMap},
|
||||||
rpc::types::{
|
rpc::types::{
|
||||||
TransactionRequest,
|
TransactionRequest,
|
||||||
trace::geth::{AccountState, DiffMode},
|
trace::geth::{AccountState, DiffMode},
|
||||||
@@ -135,12 +135,8 @@ where
|
|||||||
std::any::type_name::<T>()
|
std::any::type_name::<T>()
|
||||||
);
|
);
|
||||||
|
|
||||||
let tx = match input.legacy_transaction(
|
let tx =
|
||||||
self.config.network_id,
|
match input.legacy_transaction(nonce, &self.deployed_contracts, &self.deployed_abis) {
|
||||||
nonce,
|
|
||||||
&self.deployed_contracts,
|
|
||||||
&self.deployed_abis,
|
|
||||||
) {
|
|
||||||
Ok(tx) => {
|
Ok(tx) => {
|
||||||
tracing::debug!("Legacy transaction data: {tx:#?}");
|
tracing::debug!("Legacy transaction data: {tx:#?}");
|
||||||
tx
|
tx
|
||||||
@@ -201,6 +197,9 @@ where
|
|||||||
|
|
||||||
for contracts in contract_map.values() {
|
for contracts in contract_map.values() {
|
||||||
for (contract_name, contract) in contracts {
|
for (contract_name, contract) in contracts {
|
||||||
|
let tracing_span = tracing::info_span!("Deploying contract", contract_name);
|
||||||
|
let _guard = tracing_span.enter();
|
||||||
|
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
"Contract name is: {:?} and the input name is: {:?}",
|
"Contract name is: {:?} and the input name is: {:?}",
|
||||||
&contract_name,
|
&contract_name,
|
||||||
@@ -228,16 +227,14 @@ where
|
|||||||
std::any::type_name::<T>()
|
std::any::type_name::<T>()
|
||||||
);
|
);
|
||||||
|
|
||||||
let tx = TransactionRequest {
|
// We are using alloy for building and submitting the transactions and it will
|
||||||
from: Some(input.caller),
|
// automatically fill in all of the missing fields from the provider that we
|
||||||
to: Some(TxKind::Create),
|
// are using.
|
||||||
gas_price: Some(5_000_000),
|
let code = alloy::hex::decode(&code)?;
|
||||||
gas: Some(5_000_000),
|
let tx = TransactionRequest::default()
|
||||||
chain_id: Some(self.config.network_id),
|
.nonce(nonce)
|
||||||
nonce: Some(nonce),
|
.from(input.caller)
|
||||||
input: TransactionInput::new(Bytes::from(code.into_bytes())),
|
.with_deploy_code(code);
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let receipt = match node.execute_transaction(tx) {
|
let receipt = match node.execute_transaction(tx) {
|
||||||
Ok(receipt) => receipt,
|
Ok(receipt) => receipt,
|
||||||
|
|||||||
+10
-21
@@ -3,8 +3,9 @@ use std::collections::HashMap;
|
|||||||
use alloy::{
|
use alloy::{
|
||||||
hex,
|
hex,
|
||||||
json_abi::{Function, JsonAbi},
|
json_abi::{Function, JsonAbi},
|
||||||
primitives::{Address, Bytes, TxKind},
|
network::TransactionBuilder,
|
||||||
rpc::types::{TransactionInput, TransactionRequest},
|
primitives::{Address, Bytes},
|
||||||
|
rpc::types::TransactionRequest,
|
||||||
};
|
};
|
||||||
use alloy_primitives::U256;
|
use alloy_primitives::U256;
|
||||||
use alloy_sol_types::SolValue;
|
use alloy_sol_types::SolValue;
|
||||||
@@ -220,30 +221,18 @@ impl Input {
|
|||||||
/// Parse this input into a legacy transaction.
|
/// Parse this input into a legacy transaction.
|
||||||
pub fn legacy_transaction(
|
pub fn legacy_transaction(
|
||||||
&self,
|
&self,
|
||||||
chain_id: u64,
|
|
||||||
nonce: u64,
|
nonce: u64,
|
||||||
deployed_contracts: &HashMap<String, Address>,
|
deployed_contracts: &HashMap<String, Address>,
|
||||||
deployed_abis: &HashMap<String, JsonAbi>,
|
deployed_abis: &HashMap<String, JsonAbi>,
|
||||||
) -> anyhow::Result<TransactionRequest> {
|
) -> anyhow::Result<TransactionRequest> {
|
||||||
let to = match self.method {
|
|
||||||
Method::Deployer => Some(TxKind::Create),
|
|
||||||
_ => Some(TxKind::Call(
|
|
||||||
self.instance_to_address(&self.instance, deployed_contracts)?,
|
|
||||||
)),
|
|
||||||
};
|
|
||||||
|
|
||||||
let input_data = self.encoded_input(deployed_abis, deployed_contracts)?;
|
let input_data = self.encoded_input(deployed_abis, deployed_contracts)?;
|
||||||
|
let transaction_request = TransactionRequest::default().nonce(nonce);
|
||||||
Ok(TransactionRequest {
|
match self.method {
|
||||||
from: Some(self.caller),
|
Method::Deployer => Ok(transaction_request.with_deploy_code(input_data)),
|
||||||
to,
|
_ => Ok(transaction_request
|
||||||
nonce: Some(nonce),
|
.to(self.instance_to_address(&self.instance, deployed_contracts)?)
|
||||||
chain_id: Some(chain_id),
|
.input(input_data.into())),
|
||||||
gas_price: Some(5_000_000),
|
}
|
||||||
gas: Some(5_000_000),
|
|
||||||
input: TransactionInput::new(input_data),
|
|
||||||
..Default::default()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user