Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
test(execution): get_sequencer_address in test_validate_accounts_tx
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware authored and aner-starkware committed Feb 14, 2024
1 parent ffb16bd commit 111d38e
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 64 deletions.
31 changes: 21 additions & 10 deletions crates/blockifier/feature_contracts/cairo0/account_faulty.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.bool import FALSE, TRUE
from starkware.cairo.common.cairo_builtins import HashBuiltin
from starkware.starknet.common.syscalls import TxInfo, call_contract, get_tx_info
from starkware.starknet.common.syscalls import (
TxInfo,
call_contract,
get_sequencer_address,
get_tx_info
)
from starkware.starknet.common.messages import send_message_to_l1

// Validate Scenarios.
Expand All @@ -16,6 +21,8 @@ const VALID = 0;
const INVALID = 1;
// Make a contract call.
const CALL_CONTRACT = 2;
// Use get_sequencer_address syscall.
const GET_SEQUENCER_ADDRESS = 7;

// get_selector_from_name('foo').
const FOO_ENTRY_POINT_SELECTOR = (
Expand Down Expand Up @@ -84,16 +91,20 @@ func faulty_validate{syscall_ptr: felt*}() {
assert 0 = 1;
return ();
}
if (scenario == CALL_CONTRACT) {
let contract_address = tx_info.signature[1];
let (calldata: felt*) = alloc();
call_contract(
contract_address=contract_address,
function_selector=FOO_ENTRY_POINT_SELECTOR,
calldata_size=0,
calldata=calldata,
);
return ();
}

assert scenario = CALL_CONTRACT;
let contract_address = tx_info.signature[1];
let (calldata: felt*) = alloc();
call_contract(
contract_address=contract_address,
function_selector=FOO_ENTRY_POINT_SELECTOR,
calldata_size=0,
calldata=calldata,
);
assert scenario = GET_SEQUENCER_ADDRESS;
let sequencer_address = get_sequencer_address();
return ();
}

Expand Down
Loading

0 comments on commit 111d38e

Please sign in to comment.