Skip to content

Commit

Permalink
fix: problems after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
varex83 committed Oct 31, 2024
1 parent 0750482 commit 15ecfd9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn execute_entry_point_call(
Ok(res) => Ok(res),
}?;

create_call_info(call, call_result, syscall_handler)
create_callinfo(call_result, syscall_handler)
}

fn create_callinfo(
Expand Down
11 changes: 2 additions & 9 deletions crates/blockifier/src/execution/native/syscall_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ use cairo_native::starknet::{
U256,
};
use cairo_vm::vm::runners::cairo_runner::ExecutionResources;
use starknet_api::core::{
calculate_contract_address,
ClassHash,
ContractAddress,
EntryPointSelector,
};
use starknet_api::core::{calculate_contract_address, ClassHash, ContractAddress};
use starknet_api::state::StorageKey;
use starknet_api::transaction::{Calldata, ContractAddressSalt};
use starknet_types_core::felt::Felt;
Expand Down Expand Up @@ -47,8 +42,6 @@ pub struct NativeSyscallHandler<'state> {
pub l2_to_l1_messages: Vec<OrderedL2ToL1Message>,
pub inner_calls: Vec<CallInfo>,

pub syscall_counter: SyscallCounter,

// Additional information gathered during execution.
pub read_values: Vec<Felt>,
pub accessed_keys: HashSet<StorageKey, RandomState>,
Expand Down Expand Up @@ -174,7 +167,7 @@ impl<'state> StarknetSyscallHandler for &mut NativeSyscallHandler<'state> {
self.context.gas_costs().deploy_gas_cost,
)?;

let deployer_address = self.contract_address;
let deployer_address = self.call.storage_address;
let deployer_address_for_calculation =
if deploy_from_zero { ContractAddress::default() } else { deployer_address };

Expand Down
21 changes: 17 additions & 4 deletions crates/blockifier/src/execution/syscalls/syscall_tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ use crate::test_utils::initial_test_state::test_state;
use crate::test_utils::{calldata_for_deploy_test, trivial_external_entry_point_new, CairoVersion};

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1), 206800;"VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Native), 216800;"Native")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native), 216800;"Native")
)]
fn no_constructor(deployer_contract: FeatureContract, expected_gas: u64) {
// TODO(Yoni): share the init code of the tests in this file.

Expand Down Expand Up @@ -64,7 +67,10 @@ fn no_constructor(deployer_contract: FeatureContract, expected_gas: u64) {
}

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1);"VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Native);"Native")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native);"Native")
)]
fn no_constructor_nonempty_calldata(deployer_contract: FeatureContract) {
let empty_contract = FeatureContract::Empty(CairoVersion::Cairo1);
let class_hash = empty_contract.get_class_hash();
Expand All @@ -89,8 +95,12 @@ fn no_constructor_nonempty_calldata(deployer_contract: FeatureContract) {
constructor."
));
}
#[test_case(FeatureContract::TestContract(CairoVersion::Native),236750, 15210;"Native")]

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1),216750, 5210;"VM")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native),236750, 15210;"Native")
)]
fn with_constructor(
deployer_contract: FeatureContract,
expected_gas: u64,
Expand Down Expand Up @@ -153,7 +163,10 @@ fn with_constructor(
}

#[test_case(FeatureContract::TestContract(CairoVersion::Cairo1);"VM")]
#[test_case(FeatureContract::TestContract(CairoVersion::Native);"Native")]
#[cfg_attr(
feature = "cairo_native",
test_case(FeatureContract::TestContract(CairoVersion::Native);"Native")
)]
fn to_unavailable_address(deployer_contract: FeatureContract) {
let empty_contract = FeatureContract::Empty(CairoVersion::Cairo1);
let mut state = test_state(
Expand Down

0 comments on commit 15ecfd9

Please sign in to comment.