Skip to content

Commit

Permalink
bump blockifier to sequencer monorepo (#758)
Browse files Browse the repository at this point in the history
* bump blockifier to sequencer monorepo

* fmt

* fix clippy

* add missing versioned constants

* add missing versioned constants in other file
  • Loading branch information
tcoratger authored Sep 16, 2024
1 parent c6a121b commit 9ec2b19
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 212 deletions.
365 changes: 207 additions & 158 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ revm-interpreter = { version = "10.0.0", default-features = false }
revm-primitives = { version = "9.0.0", default-features = false }

# Starknet deps
cairo-lang-casm = "2.7.0-rc.3"
cairo-lang-starknet = "2.7.0-rc.3"
cairo-lang-utils = "2.7.0-rc.3"
cairo-lang-starknet-classes = "2.7.0-rc.3"
cairo-vm = "1.0.0-rc5"
blockifier = { package = "blockifier", git = "https://github.com/kkrt-labs/blockifier.git", rev = "57377d6", default-features = false, features = [
cairo-lang-casm = "2.8.0"
cairo-lang-starknet = "2.8.0"
cairo-lang-utils = "2.8.0"
cairo-lang-starknet-classes = "2.8.0"
cairo-vm = "1.0.1"
blockifier = { package = "blockifier", git = "https://github.com/kkrt-labs/sequencer.git", rev = "d1f32e2", default-features = false, features = [
"testing",
] }
starknet = "0.11.0"
starknet-crypto = "0.7.1"
starknet_api = "0.13.0-rc.0"
starknet_api = { package = "starknet_api", git = "https://github.com/kkrt-labs/sequencer.git", rev = "d1f32e2" }

# Other
async-trait = "0.1"
Expand Down
14 changes: 8 additions & 6 deletions crates/ef-testing/src/evm_sequencer/sequencer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ impl KakarotSequencer {
)
.try_into()
.expect("Failed to convert to ContractAddress"),
gas_prices: GasPrices {
eth_l1_gas_price: NonZeroU128::new(1).unwrap(),
strk_l1_gas_price: NonZeroU128::new(1).unwrap(),
eth_l1_data_gas_price: NonZeroU128::new(1).unwrap(),
strk_l1_data_gas_price: NonZeroU128::new(1).unwrap(),
},
gas_prices: GasPrices::new(
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
),
use_kzg_da: false,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@
"memory_hole_gas_cost": 10,
"nop_entry_point_offset": -1,
"range_check_gas_cost": 70,
"pedersen_gas_cost": 0,
"bitwise_builtin_gas_cost": 594,
"ecop_gas_cost": 0,
"poseidon_gas_cost": 0,
"add_mod_gas_cost": 0,
"mul_mod_gas_cost": 0,
"replace_class_gas_cost": {
"step_gas_cost": 50,
"syscall_base_gas_cost": 1
Expand Down
2 changes: 1 addition & 1 deletion crates/ef-testing/src/models/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) fn extract_output_and_log_execution_result(
return None;
}

info!("{} passed: {:?}", case, info.transaction_receipt.resources);
info!("{} passed: {:?}", case, info.receipt.resources);
if let Some(call) = info.execute_call_info.as_ref() {
use starknet::core::types::Felt;
let events = kakarot_execution_events(call);
Expand Down
5 changes: 5 additions & 0 deletions crates/sequencer/src/resources/versioned_constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@
"memory_hole_gas_cost": 10,
"nop_entry_point_offset": -1,
"range_check_gas_cost": 70,
"pedersen_gas_cost": 0,
"bitwise_builtin_gas_cost": 594,
"ecop_gas_cost": 0,
"poseidon_gas_cost": 0,
"add_mod_gas_cost": 0,
"mul_mod_gas_cost": 0,
"replace_class_gas_cost": {
"step_gas_cost": 50,
"syscall_base_gas_cost": 1
Expand Down
52 changes: 28 additions & 24 deletions crates/sequencer/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where
}
blockifier::transaction::account_transaction::AccountTransaction::DeployAccount(
tx,
) => tx.contract_address,
) => tx.contract_address(),
},
Transaction::L1HandlerTransaction(_) => ContractAddress::from(0u8),
};
Expand Down Expand Up @@ -130,9 +130,9 @@ mod tests {
use starknet::core::types::Felt;
use starknet::macros::selector;
use starknet_api::core::{ChainId, ClassHash, ContractAddress, Nonce};
use starknet_api::executable_transaction::InvokeTransaction;
use starknet_api::transaction::{
Calldata, Fee, InvokeTransaction, InvokeTransactionV1, TransactionHash,
TransactionSignature,
Calldata, Fee, InvokeTransactionV1, TransactionHash, TransactionSignature,
};

use crate::constants::test_constants::{
Expand Down Expand Up @@ -255,12 +255,14 @@ mod tests {
block_number: *ONE_BLOCK_NUMBER,
block_timestamp: *ONE_BLOCK_TIMESTAMP,
sequencer_address: *SEQUENCER_ADDRESS,
gas_prices: GasPrices {
eth_l1_gas_price: NonZeroU128::new(1).unwrap(),
strk_l1_gas_price: NonZeroU128::new(1).unwrap(),
eth_l1_data_gas_price: NonZeroU128::new(1).unwrap(),
strk_l1_data_gas_price: NonZeroU128::new(1).unwrap(),
},
gas_prices: GasPrices::new(
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
NonZeroU128::new(1).unwrap(),
),
use_kzg_da: false,
};

Expand All @@ -283,22 +285,24 @@ mod tests {

fn test_transaction() -> Transaction {
Transaction::AccountTransaction(AccountTransaction::Invoke(BlockifierInvokeTransaction {
tx: InvokeTransaction::V1(InvokeTransactionV1 {
sender_address: *TEST_ACCOUNT,
calldata: Calldata(
vec![
*TEST_CONTRACT.0.key(), // destination
selector!("inc"),
*ZERO_FELT, // no data
]
.into(),
),
max_fee: Fee(1_000_000),
signature: TransactionSignature(vec![]),
nonce: Nonce(*ZERO_FELT),
}),
tx: InvokeTransaction {
tx: starknet_api::transaction::InvokeTransaction::V1(InvokeTransactionV1 {
sender_address: *TEST_ACCOUNT,
calldata: Calldata(
vec![
*TEST_CONTRACT.0.key(), // destination
selector!("inc"),
*ZERO_FELT, // no data
]
.into(),
),
max_fee: Fee(1_000_000),
signature: TransactionSignature(vec![]),
nonce: Nonce(*ZERO_FELT),
}),
tx_hash: TransactionHash(*ZERO_FELT),
},
only_query: false,
tx_hash: TransactionHash(*ZERO_FELT),
}))
}

Expand Down
40 changes: 24 additions & 16 deletions crates/sequencer/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use blockifier::transaction::{
use starknet::core::crypto::compute_hash_on_elements;
use starknet::core::types::{BroadcastedInvokeTransaction, BroadcastedTransaction, Felt};
use starknet_api::core::Nonce;
use starknet_api::transaction::InvokeTransaction;
use starknet_api::executable_transaction::InvokeTransaction;
use starknet_api::transaction::{
Calldata, Fee, InvokeTransactionV1, TransactionHash, TransactionSignature,
};
Expand Down Expand Up @@ -36,23 +36,31 @@ impl BroadcastedTransactionWrapper {
BroadcastedInvokeTransaction::V1(invoke_v1) => {
Ok(ExecutionTransaction::AccountTransaction(
AccountTransaction::Invoke(BlockifierInvokeTransaction {
tx: InvokeTransaction::V1(InvokeTransactionV1 {
max_fee: Fee(invoke_v1.max_fee.to_biguint().try_into()?),
signature: TransactionSignature(
invoke_v1.signature.into_iter().map(Into::into).collect(),
tx: InvokeTransaction {
tx: starknet_api::transaction::InvokeTransaction::V1(
InvokeTransactionV1 {
max_fee: Fee(invoke_v1.max_fee.to_biguint().try_into()?),
signature: TransactionSignature(
invoke_v1
.signature
.into_iter()
.map(Into::into)
.collect(),
),
nonce: Nonce(invoke_v1.nonce),
sender_address: invoke_v1.sender_address.try_into()?,
calldata: Calldata(Arc::new(invoke_v1.calldata.to_vec())),
},
),
nonce: Nonce(invoke_v1.nonce),
sender_address: invoke_v1.sender_address.try_into()?,
calldata: Calldata(Arc::new(invoke_v1.calldata.to_vec())),
}),
tx_hash: TransactionHash(compute_transaction_hash(
invoke_v1.sender_address,
&invoke_v1.calldata,
invoke_v1.max_fee,
chain_id,
invoke_v1.nonce,
)),
},
only_query: false,
tx_hash: TransactionHash(compute_transaction_hash(
invoke_v1.sender_address,
&invoke_v1.calldata,
invoke_v1.max_fee,
chain_id,
invoke_v1.nonce,
)),
}),
))
}
Expand Down

0 comments on commit 9ec2b19

Please sign in to comment.