Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] Tracking branch native 2.9.x #19

Draft
wants to merge 6 commits into
base: native2.8.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,214 changes: 742 additions & 472 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ license-file = "LICENSE"
# TODO: Remove this once udeps is fixed.
anyhow = "1.0.44"
ark-ec = "0.4.2"
ark-ff = "0.4.0-alpha.7"
ark-ff = "0.4.2"
ark-secp256k1 = "0.4.0"
ark-secp256r1 = "0.4.0"
assert-json-diff = "2.0.2"
Expand All @@ -74,14 +74,14 @@ byteorder = "1.4.3"
bytes = "1"
cached = "0.44.0"
cairo-felt = "0.9.1"
cairo-lang-casm = "2.8.4"
cairo-lang-runner = "2.8.4"
cairo-lang-sierra = "2.8.4"
cairo-lang-sierra-to-casm = "2.8.4"
cairo-lang-starknet-classes = "2.8.4"
cairo-lang-utils = "2.8.4"
cairo-lang-casm = "2.9.0-dev.0"
cairo-lang-runner = "2.9.0-dev.0"
cairo-lang-sierra = "2.9.0-dev.0"
cairo-lang-sierra-to-casm = "2.9.0-dev.0"
cairo-lang-starknet-classes = "2.9.0-dev.0"
cairo-lang-utils = "2.9.0-dev.0"
# This is a temporary dependency, will be removed once the new version of cairo-native is released to main.
cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "ebfa9a116d03618e90fc52773e73958b179dd775" }
cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "5e60089288c461eca98bf3dbe03cc882778ff677" }
cairo-vm = "1.0.1"
camelpaste = "0.1.0"
chrono = "0.4.26"
Expand Down Expand Up @@ -171,7 +171,7 @@ serde_repr = "0.1.19"
serde_yaml = "0.9.16"
sha2 = "0.10.8"
sha3 = "0.10.8"
sierra-emu = { git = "https://github.com/lambdaclass/sierra-emu.git", rev = "0b11466033d7f070fcdd13cb81681b0fd9aaaa00" }
sierra-emu = { git = "https://github.com/lambdaclass/sierra-emu.git", rev = "369a3eaebc0ab189f06dfc3662e270479a8ad17a"}
simple_logger = "4.0.0"
starknet-core = "0.6.0"
starknet-crypto = "0.5.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/batcher/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;

use papyrus_config::dumping::{ser_param, SerializeConfig};
use papyrus_config::dumping::{SerializeConfig, ser_param};
use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam};
use serde::{Deserialize, Serialize};
use validator::Validate;
Expand Down
2 changes: 1 addition & 1 deletion crates/batcher/src/proposals_manager.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;
use std::sync::Arc;

use papyrus_config::dumping::{ser_param, SerializeConfig};
use papyrus_config::dumping::{SerializeConfig, ser_param};
use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam};
use serde::{Deserialize, Serialize};
use starknet_api::block::BlockNumber;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/bench/blockifier_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use blockifier::test_utils::transfers_generator::{
TransfersGenerator,
TransfersGeneratorConfig,
};
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};

pub fn transfers_benchmark(c: &mut Criterion) {
let transfers_generator_config = TransfersGeneratorConfig {
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/abi/abi_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use sha3::{Digest, Keccak256};
use starknet_api::core::{
ContractAddress,
EntryPointSelector,
PatriciaKey,
L2_ADDRESS_UPPER_BOUND,
PatriciaKey,
};
use starknet_api::state::StorageKey;
use starknet_types_core::felt::{Felt, NonZeroFelt};
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/abi/sierra_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use cairo_vm::vm::errors::memory_errors::MemoryError;
use cairo_vm::vm::vm_core::VirtualMachine;
use num_bigint::{BigUint, ToBigUint};
use num_traits::ToPrimitive;
use starknet_api::StarknetApiError;
use starknet_api::core::{ContractAddress, PatriciaKey};
use starknet_api::state::StorageKey;
use starknet_api::StarknetApiError;
use starknet_types_core::felt::Felt;
use thiserror::Error;

Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/blockifier/block_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use starknet_api::felt;
use starknet_api::state::StorageKey;

use crate::abi::constants;
use crate::blockifier::block::{pre_process_block, BlockNumberHashPair};
use crate::blockifier::block::{BlockNumberHashPair, pre_process_block};
use crate::context::ChainInfo;
use crate::state::state_api::StateReader;
use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{CairoVersion, BALANCE};
use crate::test_utils::{BALANCE, CairoVersion};

#[test]
fn test_pre_process_block() {
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/blockifier/stateful_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use thiserror::Error;

use crate::blockifier::config::TransactionExecutorConfig;
use crate::blockifier::transaction_executor::{
BLOCK_STATE_ACCESS_ERR,
TransactionExecutor,
TransactionExecutorError,
BLOCK_STATE_ACCESS_ERR,
};
use crate::context::{BlockContext, TransactionContext};
use crate::execution::call_info::CallInfo;
Expand Down
8 changes: 4 additions & 4 deletions crates/blockifier/src/blockifier/stateful_validator_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use crate::blockifier::stateful_validator::StatefulValidator;
use crate::context::BlockContext;
use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::{fund_account, test_state};
use crate::test_utils::{CairoVersion, BALANCE};
use crate::test_utils::{BALANCE, CairoVersion};
use crate::transaction::account_transaction::AccountTransaction;
use crate::transaction::test_utils::{
block_context,
create_account_tx_for_validate_test_nonce_0,
max_resource_bounds,
FaultyAccountTxCreatorArgs,
INVALID,
VALID,
block_context,
create_account_tx_for_validate_test_nonce_0,
max_resource_bounds,
};
use crate::transaction::transaction_types::TransactionType;

Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/blockifier/transaction_executor.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(feature = "concurrency")]
use std::collections::{HashMap, HashSet};
#[cfg(feature = "concurrency")]
use std::panic::{self, catch_unwind, AssertUnwindSafe};
use std::panic::{self, AssertUnwindSafe, catch_unwind};
#[cfg(feature = "concurrency")]
use std::sync::Arc;
#[cfg(feature = "concurrency")]
Expand Down
19 changes: 9 additions & 10 deletions crates/blockifier/src/blockifier/transaction_executor_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use starknet_types_core::felt::Felt;

use crate::blockifier::config::TransactionExecutorConfig;
use crate::blockifier::transaction_executor::{
BLOCK_STATE_ACCESS_ERR,
TransactionExecutor,
TransactionExecutorError,
BLOCK_STATE_ACCESS_ERR,
};
use crate::bouncer::{Bouncer, BouncerWeights};
use crate::context::BlockContext;
Expand All @@ -20,22 +20,22 @@ use crate::test_utils::declare::declare_tx;
use crate::test_utils::deploy_account::deploy_account_tx;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{
create_calldata,
CairoVersion,
NonceManager,
BALANCE,
CairoVersion,
DEFAULT_STRK_L1_GAS_PRICE,
NonceManager,
create_calldata,
};
use crate::transaction::account_transaction::AccountTransaction;
use crate::transaction::errors::TransactionExecutionError;
use crate::transaction::test_utils::{
TestInitData,
account_invoke_tx,
block_context,
calculate_class_info_for_testing,
create_test_init_data,
emit_n_events_tx,
l1_resource_bounds,
TestInitData,
};
use crate::transaction::transaction_execution::Transaction;
use crate::transaction::transactions::L1HandlerTransaction;
Expand Down Expand Up @@ -201,11 +201,10 @@ fn test_invoke(
) {
let test_contract = FeatureContract::TestContract(cairo_version);
let account_contract = FeatureContract::AccountWithoutValidations(cairo_version);
let state = test_state(
&block_context.chain_info,
BALANCE,
&[(test_contract, 1), (account_contract, 1)],
);
let state = test_state(&block_context.chain_info, BALANCE, &[
(test_contract, 1),
(account_contract, 1),
]);

let calldata =
create_calldata(test_contract.get_instance_address(0), entry_point_name, &entry_point_args);
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/bouncer_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::blockifier::transaction_executor::{
TransactionExecutorError,
TransactionExecutorResult,
};
use crate::bouncer::{verify_tx_weights_in_bounds, Bouncer, BouncerWeights, BuiltinCount};
use crate::bouncer::{Bouncer, BouncerWeights, BuiltinCount, verify_tx_weights_in_bounds};
use crate::context::BlockContext;
use crate::execution::call_info::ExecutionSummary;
use crate::state::cached_state::{StateChangesKeys, TransactionalState};
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/fee_utils_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::invoke_tx_args;
use crate::state::state_api::StateReader;
use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::initial_test_state::{fund_account, test_state, test_state_inner};
use crate::test_utils::{create_trivial_calldata, CairoVersion, BALANCE};
use crate::test_utils::{BALANCE, CairoVersion, create_trivial_calldata};
use crate::transaction::objects::FeeType;
use crate::transaction::test_utils::{account_invoke_tx, block_context, max_resource_bounds};

Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/concurrency/flow_test.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::collections::HashMap;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::sync::atomic::Ordering;

use rstest::rstest;
use starknet_api::core::{ContractAddress, PatriciaKey};
use starknet_api::{contract_address, felt, patricia_key};

use crate::abi::sierra_types::{SierraType, SierraU128};
use crate::concurrency::scheduler::{Scheduler, Task, TransactionStatus};
use crate::concurrency::test_utils::{safe_versioned_state_for_testing, DEFAULT_CHUNK_SIZE};
use crate::concurrency::test_utils::{DEFAULT_CHUNK_SIZE, safe_versioned_state_for_testing};
use crate::concurrency::versioned_state::ThreadSafeVersionedState;
use crate::state::cached_state::{CachedState, ContractClassMapping, StateMaps};
use crate::state::state_api::UpdatableState;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::cmp::min;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Mutex, MutexGuard, TryLockError};

use crate::concurrency::utils::lock_mutex_in_array;
use crate::concurrency::TxIndex;
use crate::concurrency::utils::lock_mutex_in_array;

#[cfg(test)]
#[path = "scheduler_test.rs"]
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/concurrency/scheduler_test.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::cmp::min;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::sync::atomic::Ordering;

use pretty_assertions::assert_eq;
use rstest::rstest;

use crate::concurrency::TxIndex;
use crate::concurrency::scheduler::{Scheduler, Task, TransactionStatus};
use crate::concurrency::test_utils::DEFAULT_CHUNK_SIZE;
use crate::concurrency::TxIndex;
use crate::default_scheduler;

#[rstest]
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/versioned_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use starknet_api::core::{ClassHash, CompiledClassHash, ContractAddress, Nonce};
use starknet_api::state::StorageKey;
use starknet_types_core::felt::Felt;

use crate::concurrency::versioned_storage::VersionedStorage;
use crate::concurrency::TxIndex;
use crate::concurrency::versioned_storage::VersionedStorage;
use crate::execution::contract_class::ContractClass;
use crate::state::cached_state::{ContractClassMapping, StateMaps};
use crate::state::errors::StateError;
Expand Down
16 changes: 8 additions & 8 deletions crates/blockifier/src/concurrency/versioned_state_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ use std::thread;
use assert_matches::assert_matches;
use rstest::{fixture, rstest};
use starknet_api::core::{
calculate_contract_address,
ClassHash,
ContractAddress,
Nonce,
PatriciaKey,
calculate_contract_address,
};
use starknet_api::transaction::{Calldata, ContractAddressSalt, DeprecatedResourceBoundsMapping};
use starknet_api::{calldata, class_hash, contract_address, felt, patricia_key};

use crate::abi::abi_utils::{get_fee_token_var_address, get_storage_var_address};
use crate::concurrency::TxIndex;
use crate::concurrency::test_utils::{
class_hash,
contract_address,
Expand All @@ -25,7 +26,6 @@ use crate::concurrency::versioned_state::{
VersionedState,
VersionedStateProxy,
};
use crate::concurrency::TxIndex;
use crate::context::BlockContext;
use crate::state::cached_state::{
CachedState,
Expand All @@ -39,7 +39,7 @@ use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::deploy_account::deploy_account_tx;
use crate::test_utils::dict_state_reader::DictStateReader;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{CairoVersion, NonceManager, BALANCE, DEFAULT_STRK_L1_GAS_PRICE};
use crate::test_utils::{BALANCE, CairoVersion, DEFAULT_STRK_L1_GAS_PRICE, NonceManager};
use crate::transaction::account_transaction::AccountTransaction;
use crate::transaction::objects::{HasRelatedFeeType, TransactionInfoCreator};
use crate::transaction::test_utils::{l1_resource_bounds, max_resource_bounds};
Expand Down Expand Up @@ -212,11 +212,11 @@ fn test_run_parallel_txs(max_resource_bounds: DeprecatedResourceBoundsMapping) {
FeatureContract::AccountWithoutValidations(CairoVersion::Cairo0);

// Initiate States
let versioned_state = Arc::new(Mutex::new(VersionedState::new(test_state(
chain_info,
BALANCE,
&[(account_without_validation, 1), (grindy_account, 1)],
))));
let versioned_state =
Arc::new(Mutex::new(VersionedState::new(test_state(chain_info, BALANCE, &[
(account_without_validation, 1),
(grindy_account, 1),
]))));

let safe_versioned_state = ThreadSafeVersionedState(Arc::clone(&versioned_state));
let mut versioned_state_proxy_1 = safe_versioned_state.pin_version(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use pretty_assertions::assert_eq;
use rstest::rstest;
use starknet_api::core::{ClassHash, ContractAddress};

use crate::concurrency::TxIndex;
use crate::concurrency::test_utils::{class_hash, contract_address};
use crate::concurrency::versioned_storage::VersionedStorage;
use crate::concurrency::TxIndex;

// TODO(barak, 01/07/2024): Split into test_read() and test_write().
#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/concurrency/worker_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use starknet_api::core::ClassHash;
use super::versioned_state::VersionedState;
use crate::blockifier::transaction_executor::TransactionExecutorError;
use crate::bouncer::Bouncer;
use crate::concurrency::TxIndex;
use crate::concurrency::fee_utils::complete_fee_transfer_flow;
use crate::concurrency::scheduler::{Scheduler, Task};
use crate::concurrency::utils::lock_mutex_in_array;
use crate::concurrency::versioned_state::ThreadSafeVersionedState;
use crate::concurrency::TxIndex;
use crate::context::BlockContext;
use crate::state::cached_state::{
ContractClassMapping,
Expand Down
6 changes: 3 additions & 3 deletions crates/blockifier/src/concurrency/worker_logic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::declare::declare_tx;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{
create_calldata,
create_trivial_calldata,
BALANCE,
CairoVersion,
NonceManager,
BALANCE,
TEST_ERC20_CONTRACT_ADDRESS2,
create_calldata,
create_trivial_calldata,
};
use crate::transaction::account_transaction::AccountTransaction;
use crate::transaction::constants::DEPLOY_CONTRACT_FUNCTION_ENTRY_POINT_NAME;
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;

use papyrus_config::dumping::{append_sub_config_name, ser_param, SerializeConfig};
use papyrus_config::dumping::{SerializeConfig, append_sub_config_name, ser_param};
use papyrus_config::{ParamPath, ParamPrivacyInput, SerializedParam};
use serde::{Deserialize, Serialize};
use starknet_api::core::{ChainId, ContractAddress};
Expand Down
4 changes: 2 additions & 2 deletions crates/blockifier/src/execution/contract_address_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rstest::rstest;
use starknet_api::core::{calculate_contract_address, ClassHash, ContractAddress};
use starknet_api::core::{ClassHash, ContractAddress, calculate_contract_address};
use starknet_api::transaction::{Calldata, ContractAddressSalt};
use starknet_api::{calldata, felt};

Expand All @@ -12,7 +12,7 @@ use crate::state::cached_state::CachedState;
use crate::test_utils::contracts::FeatureContract;
use crate::test_utils::dict_state_reader::DictStateReader;
use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{CairoVersion, BALANCE};
use crate::test_utils::{BALANCE, CairoVersion};
use crate::versioned_constants::VersionedConstants;

#[rstest]
Expand Down
Loading
Loading