Skip to content

Commit 6c8d028

Browse files
committed
bump to blockifier 16
1 parent 471bf33 commit 6c8d028

File tree

16 files changed

+1678
-2427
lines changed

16 files changed

+1678
-2427
lines changed

Cargo.lock

Lines changed: 1573 additions & 2351 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ members = [
4747
"crates/utils",
4848
"tests/db-compat",
4949
"tests/reverse-proxy",
50-
"tests/snos",
5150
]
5251

5352
[workspace.package]
@@ -111,13 +110,13 @@ katana-trie = { path = "crates/trie" }
111110
katana-utils = { path = "crates/utils" }
112111

113112
# cairo-lang
114-
cairo-lang-casm = "2.11.2"
115-
cairo-lang-runner = "2.11.2"
116-
cairo-lang-sierra = "2.11.2"
117-
cairo-lang-sierra-to-casm = "2.11.2"
118-
cairo-lang-starknet = "2.11.2"
119-
cairo-lang-starknet-classes = "2.11.2"
120-
cairo-lang-utils = "2.11.2"
113+
cairo-lang-casm = "2.12.3"
114+
cairo-lang-runner = "2.12.3"
115+
cairo-lang-sierra = "2.12.3"
116+
cairo-lang-sierra-to-casm = "2.12.3"
117+
cairo-lang-starknet = "2.12.3"
118+
cairo-lang-starknet-classes = "2.12.3"
119+
cairo-lang-utils = "2.12.3"
121120

122121
anyhow = "1.0.89"
123122
arbitrary = { version = "1.3.2", features = [ "derive" ] }
@@ -223,25 +222,17 @@ opentelemetry-gcloud-trace = "0.20"
223222
opentelemetry-http = "0.30.0"
224223
opentelemetry-stackdriver = { version = "0.27.0", features = [ "propagator" ] }
225224

226-
# starknet
227-
starknet = "0.17.0-rc.2"
228-
starknet-crypto = "0.7.4"
229-
starknet-types-core = { version = "0.1.8", features = [ "arbitrary", "hash" ] }
225+
starknet = "0.17.0"
226+
starknet-crypto = "0.8.1"
227+
starknet-types-core = { version = "=0.2.0", features = [ "arbitrary", "hash" ] }
228+
229+
blockifier = { git = "https://github.com/dojoengine/sequencer", branch = "blockifier/v0.16.0-rc.0", default-features = false }
230+
cairo-native = "0.6.2"
231+
starknet_api = { git = "https://github.com/dojoengine/sequencer", branch = "blockifier/v0.16.0-rc.0" }
230232
# Some types that we used from cairo-vm implements the `Arbitrary` trait,
231233
# only under the `test_utils` feature.
232-
cairo-vm = { version = "1.0.2", features = [ "test_utils" ] }
233-
234-
blockifier = { git = "https://github.com/dojoengine/sequencer", rev = "5d737b9c9", default-features = false }
235-
starknet_api = { git = "https://github.com/dojoengine/sequencer", rev = "5d737b9c9" }
236-
237-
cainome = { git = "https://github.com/cartridge-gg/cainome", rev = "7d60de1", features = [ "abigen-rs" ] }
238-
cainome-cairo-serde = { git = "https://github.com/cartridge-gg/cainome", rev = "7d60de1" }
239-
piltover = { git = "https://github.com/kariy/piltover.git", branch = "feat/rpc0.9" }
240-
241-
[patch.crates-io]
242-
starknet = { git = "https://github.com/kariy/starknet-rs", rev = "2ef3088" }
243-
# NOTE: remove this patch once this PR is merged <https://github.com/starknet-io/types-rs/pull/132>
244-
#
245-
# This patch fixes an issue where we're unable to correctly evaluate the accurate size
246-
# for constructing `Felt` from unstructured data (Arbitrary).
247-
starknet-types-core = { git = "https://github.com/kariy/types-rs", rev = "0f6ae31" }
234+
cairo-vm = { version = "2.5.0", features = [ "test_utils" ] }
235+
236+
cainome = { version = "0.10.1", features = [ "abigen-rs" ] }
237+
cainome-cairo-serde = { version = "0.4.0" }
238+
piltover = { git = "https://github.com/cartridge-gg/piltover", rev = "3d3426c" }

bin/katana/src/cli/rpc/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Client {
4747
/// ```
4848
pub async fn send_request<R, Params>(&self, method: &str, params: Params) -> Result<R>
4949
where
50-
R: serde::de::DeserializeOwned,
50+
R: serde::de::DeserializeOwned + Send ,
5151
Params: ToRpcParams + Send,
5252
{
5353
match self.client.request(method, params).await {

crates/contracts/macro/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ serde_json = "1.0"
1313
syn = { version = "2.0", features = [ "extra-traits", "full" ] }
1414

1515
# Dependencies for contract class parsing and hash computation
16-
cairo-lang-starknet-classes = "2.11.2"
17-
katana-primitives = { path = "../../primitives" }
18-
starknet-crypto = "0.7.4"
19-
starknet-types-core = "0.1.8"
16+
cairo-lang-starknet-classes.workspace = true
17+
katana-primitives.workspace = true
18+
starknet-crypto.workspace = true
19+
starknet-types-core.workspace = true

crates/executor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tracing.workspace = true
2020

2121
# cairo-native
2222
cairo-lang-starknet-classes = { workspace = true, optional = true }
23-
cairo-native = { version = "0.4.1", optional = true }
23+
cairo-native = { workspace = true, optional = true }
2424
cairo-vm.workspace = true
2525
parking_lot.workspace = true
2626
rayon = { workspace = true, optional = true }

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::str::FromStr;
22
use std::sync::Arc;
33

44
use blockifier::blockifier_versioned_constants::VersionedConstants;
5-
use blockifier::bouncer::n_steps_to_sierra_gas;
5+
use blockifier::bouncer::n_steps_to_gas;
66
use blockifier::context::{BlockContext, TransactionContext};
77
use blockifier::execution::call_info::CallInfo;
88
use blockifier::execution::entry_point::{
@@ -138,9 +138,7 @@ pub fn get_call_sierra_gas_consumed(
138138
// steps to sierra gas.
139139
//
140140
// https://github.com/dojoengine/sequencer/blob/5d737b9c90a14bdf4483d759d1a1d4ce64aa9fd2/crates/blockifier/src/execution/entry_point_execution.rs#L475-L479
141-
TrackedResource::CairoSteps => {
142-
n_steps_to_sierra_gas(info.resources.n_steps, versioned_constant).0
143-
}
141+
TrackedResource::CairoSteps => n_steps_to_gas(info.resources.n_steps, versioned_constant).0,
144142

145143
TrackedResource::SierraGas => info.execution.gas_consumed,
146144
}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ impl From<EntryPointExecutionError> for ExecutionError {
4646
}
4747
}
4848

49+
impl From<Box<EntryPointExecutionError>> for ExecutionError {
50+
fn from(error: Box<EntryPointExecutionError>) -> Self {
51+
Self::from(*error)
52+
}
53+
}
54+
4955
impl From<PreExecutionError> for ExecutionError {
5056
fn from(error: PreExecutionError) -> Self {
5157
match error {
@@ -77,6 +83,12 @@ impl From<TransactionPreValidationError> for ExecutionError {
7783
}
7884
}
7985

86+
impl From<Box<TransactionPreValidationError>> for ExecutionError {
87+
fn from(error: Box<TransactionPreValidationError>) -> Self {
88+
Self::from(*error)
89+
}
90+
}
91+
8092
impl From<TransactionFeeError> for ExecutionError {
8193
fn from(error: TransactionFeeError) -> Self {
8294
match error {
@@ -92,6 +104,12 @@ impl From<TransactionFeeError> for ExecutionError {
92104
}
93105
}
94106

107+
impl From<Box<TransactionFeeError>> for ExecutionError {
108+
fn from(error: Box<TransactionFeeError>) -> Self {
109+
Self::from(*error)
110+
}
111+
}
112+
95113
impl From<StateError> for ExecutionError {
96114
fn from(error: StateError) -> Self {
97115
match error {

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33
// Re-export the blockifier crate.
44
pub use blockifier;
55
use blockifier::blockifier_versioned_constants::VersionedConstants;
6-
use blockifier::bouncer::{n_steps_to_sierra_gas, Bouncer, BouncerConfig, BouncerWeights};
6+
use blockifier::bouncer::{Bouncer, BouncerConfig, BouncerWeights, BuiltinWeights, n_steps_to_gas};
77

88
pub mod cache;
99
pub mod call;
@@ -144,9 +144,13 @@ impl<'a> StarknetVMProcessor<'a> {
144144
//
145145
// To learn more about the L2 gas, refer to <https://community.starknet.io/t/starknet-v0-13-4-pre-release-notes/115257>.
146146
block_max_capacity.sierra_gas =
147-
n_steps_to_sierra_gas(limits.cairo_steps as usize, block_context.versioned_constants());
147+
n_steps_to_gas(limits.cairo_steps as usize, block_context.versioned_constants());
148148

149-
let bouncer = Bouncer::new(BouncerConfig { block_max_capacity });
149+
let bouncer = Bouncer::new(BouncerConfig {
150+
block_max_capacity,
151+
builtin_weights: BuiltinWeights::default(),
152+
..Default::default()
153+
});
150154

151155
Self {
152156
cfg_env,
@@ -201,7 +205,7 @@ impl<'a> StarknetVMProcessor<'a> {
201205
use_kzg_da: false,
202206
};
203207

204-
let sn_version = header.starknet_version.try_into().expect("valid version");
208+
let sn_version: starknet_api::block::StarknetVersion = starknet_api::block::StarknetVersion::V0_14_0;
205209
let mut versioned_constants = VersionedConstants::get(&sn_version).unwrap().clone();
206210

207211
// Only apply overrides if provided
@@ -271,6 +275,7 @@ impl<'a> BlockExecutor<'a> for StarknetVMProcessor<'a> {
271275
}
272276

273277
crate::utils::log_resources(&trace.receipt.resources);
278+
crate::utils::log_messages(&receipt.messages_sent());
274279
}
275280

276281
ExecutionResult::Failed { error } => {

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ pub fn transact<S: StateReader>(
139139
&tx_state,
140140
&tx_state_changes_keys,
141141
&info.summarize(versioned_constants),
142+
&info.summarize_builtins(),
142143
&info.receipt.resources,
143144
versioned_constants,
144145
)?;
@@ -203,7 +204,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
203204
tx: ApiInvokeTransaction::V0(starknet_api::transaction::InvokeTransactionV0 {
204205
entry_point_selector: EntryPointSelector(tx.entry_point_selector),
205206
contract_address: to_blk_address(tx.contract_address),
206-
signature: TransactionSignature(signature),
207+
signature: TransactionSignature(signature.into()),
207208
calldata: Calldata(Arc::new(calldata)),
208209
max_fee: Fee(tx.max_fee),
209210
}),
@@ -225,7 +226,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
225226
max_fee: Fee(tx.max_fee),
226227
nonce: Nonce(tx.nonce),
227228
sender_address: to_blk_address(tx.sender_address),
228-
signature: TransactionSignature(signature),
229+
signature: TransactionSignature(signature.into()),
229230
calldata: Calldata(Arc::new(calldata)),
230231
}),
231232
tx_hash: TransactionHash(hash),
@@ -251,7 +252,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
251252
tip: Tip(tx.tip),
252253
nonce: Nonce(tx.nonce),
253254
sender_address: to_blk_address(tx.sender_address),
254-
signature: TransactionSignature(signature),
255+
signature: TransactionSignature(signature.into()),
255256
calldata: Calldata(Arc::new(calldata)),
256257
paymaster_data: PaymasterData(paymaster_data),
257258
account_deployment_data: AccountDeploymentData(account_deploy_data),
@@ -281,7 +282,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
281282
tx: ApiDeployAccountTransaction::V1(DeployAccountTransactionV1 {
282283
max_fee: Fee(tx.max_fee),
283284
nonce: Nonce(tx.nonce),
284-
signature: TransactionSignature(signature),
285+
signature: TransactionSignature(signature.into()),
285286
class_hash: ClassHash(tx.class_hash),
286287
constructor_calldata: Calldata(Arc::new(calldata)),
287288
contract_address_salt: salt,
@@ -309,7 +310,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
309310
tx: ApiDeployAccountTransaction::V3(DeployAccountTransactionV3 {
310311
tip: Tip(tx.tip),
311312
nonce: Nonce(tx.nonce),
312-
signature: TransactionSignature(signature),
313+
signature: TransactionSignature(signature.into()),
313314
class_hash: ClassHash(tx.class_hash),
314315
constructor_calldata: Calldata(Arc::new(calldata)),
315316
contract_address_salt: salt,
@@ -336,15 +337,15 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
336337
max_fee: Fee(tx.max_fee),
337338
nonce: Nonce::default(),
338339
sender_address: to_blk_address(tx.sender_address),
339-
signature: TransactionSignature(tx.signature),
340+
signature: TransactionSignature(tx.signature.into()),
340341
class_hash: ClassHash(tx.class_hash),
341342
}),
342343

343344
DeclareTx::V1(tx) => ApiDeclareTransaction::V1(DeclareTransactionV0V1 {
344345
max_fee: Fee(tx.max_fee),
345346
nonce: Nonce(tx.nonce),
346347
sender_address: to_blk_address(tx.sender_address),
347-
signature: TransactionSignature(tx.signature),
348+
signature: TransactionSignature(tx.signature.into()),
348349
class_hash: ClassHash(tx.class_hash),
349350
}),
350351

@@ -355,7 +356,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
355356
max_fee: Fee(tx.max_fee),
356357
nonce: Nonce(tx.nonce),
357358
sender_address: to_blk_address(tx.sender_address),
358-
signature: TransactionSignature(signature),
359+
signature: TransactionSignature(signature.into()),
359360
class_hash: ClassHash(tx.class_hash),
360361
compiled_class_hash: CompiledClassHash(tx.compiled_class_hash),
361362
})
@@ -374,7 +375,7 @@ pub fn to_executor_tx(mut tx: ExecutableTxWithHash, mut flags: ExecutionFlags) -
374375
tip: Tip(tx.tip),
375376
nonce: Nonce(tx.nonce),
376377
sender_address: to_blk_address(tx.sender_address),
377-
signature: TransactionSignature(signature),
378+
signature: TransactionSignature(signature.into()),
378379
class_hash: ClassHash(tx.class_hash),
379380
account_deployment_data: AccountDeploymentData(account_deploy_data),
380381
compiled_class_hash: CompiledClassHash(tx.compiled_class_hash),
@@ -479,14 +480,15 @@ pub fn block_context_from_envs(
479480
use_kzg_da: false,
480481
};
481482

482-
let chain_info = ChainInfo { fee_token_addresses, chain_id: to_blk_chain_id(chain_spec.id()) };
483+
//TODO: change this
484+
let chain_info: ChainInfo = ChainInfo { fee_token_addresses, chain_id: to_blk_chain_id(chain_spec.id()),is_l3: true };
483485

484486
// IMPORTANT:
485487
//
486488
// The versioned constants that we use here must match the version that is used during
487489
// re-execution with `snos`. Otherwise, there might be a mismatch between the calculated
488490
// fees.
489-
let sn_version: StarknetVersion = block_env.starknet_version.try_into().expect("valid version");
491+
let sn_version: StarknetVersion = StarknetVersion::V0_14_1;
490492
let mut versioned_constants = VersionedConstants::get(&sn_version).unwrap().clone();
491493

492494
// Only apply overrides if provided

crates/executor/src/utils.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,30 @@ pub(crate) const LOG_TARGET: &str = "executor";
1313
pub fn log_resources(resources: &TransactionResources) {
1414
let mut mapped_strings = Vec::new();
1515

16-
for (builtin, count) in &resources.computation.vm_resources.builtin_instance_counter {
16+
for (builtin, count) in &resources.computation.tx_vm_resources.builtin_instance_counter {
1717
mapped_strings.push(format!("{builtin}: {count}"));
1818
}
1919

2020
// Sort the strings alphabetically
2121
mapped_strings.sort();
22-
mapped_strings.insert(0, format!("steps: {}", resources.computation.vm_resources.n_steps));
23-
mapped_strings
24-
.insert(1, format!("memory holes: {}", resources.computation.vm_resources.n_memory_holes));
25-
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+
);
2627
trace!(target: LOG_TARGET, usage = mapped_strings.join(" | "), "Transaction resource usage.");
2728
}
2829

30+
pub fn log_messages(messages: &[MessageToL1]) {
31+
let mut mapped_strings = Vec::new();
32+
33+
for message in messages {
34+
mapped_strings.push(format!("from: {:?} to: {:?} payload: {:?}", message.from_address, message.to_address, message.payload));
35+
}
36+
37+
trace!(target: "messaging", messages = mapped_strings.join(" | "), "Transaction messages.");
38+
}
39+
2940
pub(crate) fn build_receipt(
3041
tx: &ExecutableTx,
3142
fee: FeeInfo,
@@ -74,7 +85,7 @@ pub(crate) fn build_receipt(
7485
}
7586

7687
fn get_receipt_resources(receipt: &TransactionReceipt) -> receipt::ExecutionResources {
77-
let computation_resources = receipt.resources.computation.vm_resources.clone();
88+
let computation_resources = receipt.resources.computation.tx_vm_resources.clone();
7889

7990
let gas = GasUsed {
8091
l2_gas: receipt.gas.l2_gas.0,

0 commit comments

Comments
 (0)