Skip to content

Commit 6ffdd50

Browse files
committed
Merge remote-tracking branch 'origin/main' into grpc-integration-tests
2 parents 83c3b44 + 725dfcf commit 6ffdd50

File tree

7 files changed

+37
-40
lines changed

7 files changed

+37
-40
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/executor/src/implementation/blockifier/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,21 +257,21 @@ impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> {
257257
match result {
258258
Ok(exec_result) => {
259259
match &exec_result {
260-
ExecutionResult::Success { receipt, trace } => {
260+
ExecutionResult::Success { receipt, .. } => {
261261
self.stats.l1_gas_used +=
262262
receipt.resources_used().total_gas_consumed.l1_gas as u128;
263263
self.stats.cairo_steps_used +=
264264
receipt.resources_used().vm_resources.n_steps as u128;
265265

266-
if let Some(reason) = receipt.revert_reason() {
267-
info!(target: LOG_TARGET, hash = format!("{hash:#x}"), %reason, "Transaction reverted.");
268-
}
269-
270266
if let Some((class_hash, class)) = class_decl_artifacts {
271267
state.declared_classes.insert(class_hash, class.as_ref().clone());
272268
}
273269

274-
crate::utils::log_resources(&trace.receipt.resources);
270+
if let Some(reason) = receipt.revert_reason() {
271+
info!(target: LOG_TARGET, hash = format!("{hash:#x}"), type = ?receipt.r#type(), revert_reason = %reason, "Transaction executed (reverted).");
272+
} else {
273+
info!(target: LOG_TARGET, hash = format!("{hash:#x}"), type = ?receipt.r#type(), "Transaction executed.");
274+
}
275275
}
276276

277277
ExecutionResult::Failed { error } => {

crates/executor/src/utils.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
11
use blockifier::fee::receipt::TransactionReceipt;
2-
use katana_primitives::execution::{CallInfo, TransactionExecutionInfo, TransactionResources};
2+
use katana_primitives::execution::{CallInfo, TransactionExecutionInfo};
33
use katana_primitives::fee::FeeInfo;
44
use katana_primitives::receipt::{
55
self, DataAvailabilityResources, DeclareTxReceipt, DeployAccountTxReceipt, Event, GasUsed,
66
InvokeTxReceipt, L1HandlerTxReceipt, MessageToL1, Receipt,
77
};
88
use katana_primitives::transaction::ExecutableTx;
9-
use tracing::trace;
10-
11-
pub(crate) const LOG_TARGET: &str = "executor";
12-
13-
pub fn log_resources(resources: &TransactionResources) {
14-
let mut mapped_strings = Vec::new();
15-
16-
for (builtin, count) in &resources.computation.tx_vm_resources.builtin_instance_counter {
17-
mapped_strings.push(format!("{builtin}: {count}"));
18-
}
19-
20-
// Sort the strings alphabetically
21-
mapped_strings.sort();
22-
mapped_strings.insert(0, format!("steps: {}", resources.computation.tx_vm_resources.n_steps));
23-
mapped_strings.insert(
24-
1,
25-
format!("memory holes: {}", resources.computation.tx_vm_resources.n_memory_holes),
26-
);
27-
28-
trace!(target: LOG_TARGET, usage = mapped_strings.join(" | "), "Transaction resource usage.");
29-
}
309

3110
pub(crate) fn build_receipt(
3211
tx: &ExecutableTx,

crates/rpc/rpc-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ katana-rpc-api = { workspace = true, features = [ "client" ] }
5454
katana-rpc-client.workspace = true
5555
katana-trie.workspace = true
5656
katana-genesis.workspace = true
57-
katana-utils.workspace = true
57+
katana-utils = { workspace = true, features = ["node"] }
5858

5959
alloy-contract = { workspace = true, default-features = false }
6060
alloy-node-bindings = "1.0.24"

crates/utils/Cargo.toml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ repository.workspace = true
66
version.workspace = true
77

88
[dependencies]
9-
katana-chain-spec.workspace = true
10-
katana-core.workspace = true
11-
katana-executor.workspace = true
12-
katana-node.workspace = true
139
katana-primitives.workspace = true
14-
katana-provider.workspace = true
15-
katana-rpc-server.workspace = true
1610
katana-rpc-api.workspace = true
1711
katana-rpc-client.workspace = true
1812
katana-rpc-types.workspace = true
@@ -25,10 +19,29 @@ assert_matches.workspace = true
2519
async-trait.workspace = true
2620
futures.workspace = true
2721
rand.workspace = true
28-
starknet.workspace = true
2922
thiserror.workspace = true
3023
tokio = { workspace = true, features = [ "macros", "signal", "time" ], default-features = false }
3124

25+
# node-only dependencies
26+
katana-chain-spec = { workspace = true, optional = true }
27+
katana-core = { workspace = true, optional = true }
28+
katana-executor = { workspace = true, optional = true }
29+
katana-node = { workspace = true, optional = true }
30+
katana-provider = { workspace = true, optional = true }
31+
katana-rpc-server = { workspace = true, optional = true }
32+
starknet = { workspace = true, optional = true }
33+
tempfile = { workspace = true, optional = true }
34+
3235
[features]
33-
explorer = [ "katana-node/explorer" ]
3436
grpc = [ "katana-node/grpc" ]
37+
node = [
38+
"katana-chain-spec",
39+
"katana-core",
40+
"katana-executor",
41+
"katana-node",
42+
"katana-provider",
43+
"katana-rpc-server",
44+
"starknet",
45+
"tempfile",
46+
]
47+
explorer = [ "node", "katana-node/explorer" ]

crates/utils/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
pub use arbitrary::{Arbitrary, Unstructured};
22
pub use katana_utils_macro::mock_provider;
33

4+
#[cfg(feature = "node")]
45
pub mod node;
56
mod signal;
67
mod tx_waiter;
78

9+
#[cfg(feature = "node")]
810
pub use node::TestNode;
911
pub use signal::wait_shutdown_signals;
1012
pub use tx_waiter::*;

crates/utils/src/tx_waiter.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,11 @@ mod tests {
316316
use katana_rpc_types::{ExecutionResources, FeePayment};
317317

318318
use super::{Duration, TxWaiter};
319-
use crate::{TestNode, TxWaitingError};
319+
use crate::TxWaitingError;
320320

321-
async fn create_test_sequencer() -> TestNode {
322-
TestNode::new().await
321+
#[cfg(feature = "node")]
322+
async fn create_test_sequencer() -> crate::TestNode {
323+
crate::TestNode::new().await
323324
}
324325

325326
const EXECUTION_RESOURCES: ExecutionResources =
@@ -365,6 +366,7 @@ mod tests {
365366
}
366367
}
367368

369+
#[cfg(feature = "node")]
368370
#[tokio::test]
369371
async fn should_timeout_on_nonexistant_transaction() {
370372
let sequencer = create_test_sequencer().await;

0 commit comments

Comments
 (0)