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

refactor(execution): change get fee token blance in state api to get … #134

Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/blockifier/src/state/state_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub trait StateReader {
// TODO(Dori, 1/9/2023): NEW_TOKEN_SUPPORT Determine fee token address based on tx version,
// once v3 is introduced.
fn get_fee_token_balance(
&mut self,
&self,
contract_address: ContractAddress,
fee_token_address: ContractAddress,
) -> Result<(Felt, Felt), StateError> {
Expand Down
28 changes: 8 additions & 20 deletions crates/blockifier/src/transaction/execution_flavors_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn create_flavors_test_state(
/// Returns the new balance.
fn check_balance<S: StateReader>(
current_balance: Felt,
state: &mut CachedState<S>,
state: &CachedState<S>,
account_address: ContractAddress,
chain_info: &ChainInfo,
fee_type: &FeeType,
Expand Down Expand Up @@ -469,7 +469,7 @@ fn test_simulate_validate_charge_fee_mid_execution(
);
let current_balance = check_balance(
current_balance,
&mut state,
&state,
account_address,
&block_context.chain_info,
&fee_type,
Expand Down Expand Up @@ -518,14 +518,8 @@ fn test_simulate_validate_charge_fee_mid_execution(
// charged final fee is shown in actual_fee.
if charge_fee { limited_fee } else { unlimited_fee },
);
let current_balance = check_balance(
current_balance,
&mut state,
account_address,
chain_info,
&fee_type,
charge_fee,
);
let current_balance =
check_balance(current_balance, &state, account_address, chain_info, &fee_type, charge_fee);

// Third scenario: only limit is block bounds. Expect resources consumed to be identical,
// whether or not `charge_fee` is true.
Expand Down Expand Up @@ -564,7 +558,7 @@ fn test_simulate_validate_charge_fee_mid_execution(
block_limit_fee,
block_limit_fee,
);
check_balance(current_balance, &mut state, account_address, chain_info, &fee_type, charge_fee);
check_balance(current_balance, &state, account_address, chain_info, &fee_type, charge_fee);
}

#[rstest]
Expand Down Expand Up @@ -652,14 +646,8 @@ fn test_simulate_validate_charge_fee_post_execution(
if charge_fee { just_not_enough_fee_bound } else { unlimited_fee },
if charge_fee { revert_fee } else { unlimited_fee },
);
let current_balance = check_balance(
current_balance,
&mut state,
account_address,
chain_info,
&fee_type,
charge_fee,
);
let current_balance =
check_balance(current_balance, &state, account_address, chain_info, &fee_type, charge_fee);

// Second scenario: balance too low.
// Execute a transfer, and make sure we get the expected result.
Expand Down Expand Up @@ -724,7 +712,7 @@ fn test_simulate_validate_charge_fee_post_execution(
);
check_balance(
current_balance,
&mut state,
&state,
account_address,
chain_info,
&fee_type,
Expand Down
Loading