Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions crates/core/src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
if let Some(contracts) = &last_output.contracts {
for (file, contracts_map) in contracts {
for contract_name in contracts_map.keys() {
log::debug!(

Check failure on line 93 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
"Compiled contract: {} from file: {}",
contract_name,
file
Expand Down Expand Up @@ -118,7 +118,7 @@
input: &Input,
node: &T::Blockchain,
) -> anyhow::Result<(TransactionReceipt, GethTrace, DiffMode)> {
log::trace!("Calling execute_input for input: {:?}", input);

Check failure on line 121 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string

let nonce = node.fetch_add_nonce(input.caller)?;

Expand All @@ -135,12 +135,12 @@
{
Ok(tx) => tx,
Err(err) => {
log::error!("Failed to construct legacy transaction: {:?}", err);

Check failure on line 138 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
return Err(err);
}
};

log::trace!("Executing transaction for input: {:?}", input);

Check failure on line 143 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string

let receipt = match node.execute_transaction(tx) {
Ok(receipt) => receipt,
Expand Down Expand Up @@ -206,7 +206,7 @@
.map(|b| b.object.clone());

let Some(code) = bytecode else {
log::error!("no bytecode for contract {}", contract_name);

Check failure on line 209 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
continue;
};

Expand Down Expand Up @@ -235,22 +235,32 @@
Ok(receipt) => receipt,
Err(err) => {
log::error!(
"Failed to execute transaction when deploying the contract: {:?}, {:?}",
"Failed to execute transaction when deploying the contract on node : {:?}, {:?}, {:?}",
std::any::type_name::<T>(),
&contract_name,
err
);
return Err(err);
}
};

log::info!(
"Deployment tx sent for {} with nonce {} → tx hash: {:?}, on node: {:?}",
contract_name,
nonce,
receipt.transaction_hash,
std::any::type_name::<T>(),
);

log::trace!(
"Deployed transaction receipt for contract: {} - {:?}",
"Deployed transaction receipt for contract: {} - {:?}, on node: {:?}",
&contract_name,
receipt
receipt,
std::any::type_name::<T>(),
);

let Some(address) = receipt.contract_address else {
log::error!(

Check failure on line 263 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
"contract {} deployment did not return an address",
contract_name
);
Expand All @@ -259,7 +269,12 @@

self.deployed_contracts
.insert(contract_name.clone(), address);
log::info!("deployed contract `{}` at {:?}", contract_name, address);
log::info!(
"deployed contract `{}` at {:?}, on node {:?}",
contract_name,
address,
std::any::type_name::<T>()
);
}
}
}
Expand Down Expand Up @@ -297,22 +312,22 @@
}

pub fn trace_diff_mode(label: &str, diff: &DiffMode) {
log::trace!("{} - PRE STATE:", label);

Check failure on line 315 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
for (addr, state) in &diff.pre {
Self::trace_account_state(" [pre]", addr, state);
}

log::trace!("{} - POST STATE:", label);

Check failure on line 320 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
for (addr, state) in &diff.post {
Self::trace_account_state(" [post]", addr, state);
}
}

fn trace_account_state(prefix: &str, addr: &Address, state: &AccountState) {
log::trace!("{} 0x{:x}", prefix, addr);

Check failure on line 327 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string

if let Some(balance) = &state.balance {
log::trace!("{} balance: {}", prefix, balance);

Check failure on line 330 in crates/core/src/driver/mod.rs

View workflow job for this annotation

GitHub Actions / CI on macos-14

variables can be used directly in the `format!` string
}
if let Some(nonce) = &state.nonce {
log::trace!("{} nonce: {}", prefix, nonce);
Expand Down
25 changes: 15 additions & 10 deletions crates/format/src/input.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::HashMap;

use alloy::{
json_abi::Function, network::TransactionBuilder, primitives::Address,
json_abi::Function,
primitives::{Address, TxKind},
rpc::types::TransactionRequest,
};
use semver::VersionReq;
Expand Down Expand Up @@ -109,17 +110,21 @@ impl Input {
deployed_contracts: &HashMap<String, Address>,
) -> anyhow::Result<TransactionRequest> {
let to = match self.method {
Method::Deployer => Address::ZERO,
_ => self.instance_to_address(&self.instance, deployed_contracts)?,
Method::Deployer => Some(TxKind::Create),
_ => Some(TxKind::Call(
self.instance_to_address(&self.instance, deployed_contracts)?,
)),
};

Ok(TransactionRequest::default()
.with_from(self.caller)
.with_to(to)
.with_nonce(nonce)
.with_chain_id(chain_id)
.with_gas_price(5_000_000)
.with_gas_limit(5_000_000))
Ok(TransactionRequest {
from: Some(self.caller),
to,
nonce: Some(nonce),
chain_id: Some(chain_id),
gas_price: Some(5_000_000),
gas: Some(5_000_000),
..Default::default()
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion polkadot-sdk
Submodule polkadot-sdk updated 981 files
Loading