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: use TransactionContext::fee_token_address #161

Merged
merged 1 commit into from
Jul 29, 2024
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
11 changes: 3 additions & 8 deletions crates/blockifier/src/concurrency/worker_logic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,15 @@ fn verify_sequencer_balance_update<S: StateReader>(
// We assume the balance is at most 2^128, so the "low" value is sufficient.
expected_sequencer_balance_low: u128,
) {
let TransactionContext { block_context, tx_info } = tx_context;
let tx_version_state = state.pin_version(tx_index);
let (sequencer_balance_key_low, sequencer_balance_key_high) =
get_sequencer_balance_keys(block_context);
get_sequencer_balance_keys(&tx_context.block_context);
for (expected_balance, storage_key) in [
(felt!(expected_sequencer_balance_low), sequencer_balance_key_low),
(Felt::ZERO, sequencer_balance_key_high),
] {
let actual_balance = tx_version_state
.get_storage_at(
block_context.chain_info.fee_token_address(&tx_info.fee_type()),
storage_key,
)
.unwrap();
let actual_balance =
tx_version_state.get_storage_at(tx_context.fee_token_address(), storage_key).unwrap();
assert_eq!(expected_balance, actual_balance);
}
}
Expand Down
7 changes: 3 additions & 4 deletions crates/blockifier/src/transaction/account_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl AccountTransaction {
let msb_amount = Felt::from(0_u8);

let TransactionContext { block_context, tx_info } = tx_context.as_ref();
let storage_address = block_context.chain_info.fee_token_address(&tx_info.fee_type());
let storage_address = tx_context.fee_token_address();
let fee_transfer_call = CallEntryPoint {
class_hash: None,
code_address: None,
Expand Down Expand Up @@ -388,10 +388,9 @@ impl AccountTransaction {
tx_context: Arc<TransactionContext>,
actual_fee: Fee,
) -> TransactionExecutionResult<CallInfo> {
let TransactionContext { block_context, tx_info } = tx_context.as_ref();
let fee_address = block_context.chain_info.fee_token_address(&tx_info.fee_type());
let fee_address = tx_context.fee_token_address();
let (sequencer_balance_key_low, sequencer_balance_key_high) =
get_sequencer_balance_keys(block_context);
get_sequencer_balance_keys(&tx_context.block_context);
let mut transfer_state = TransactionalState::create_transactional(state);

// Set the initial sequencer balance to avoid tarnishing the read-set of the transaction.
Expand Down
Loading