Skip to content

Commit

Permalink
apply pr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Sep 12, 2024
1 parent 938fc33 commit daf20b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
3 changes: 1 addition & 2 deletions crates/contracts/src/account_contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ pub mod AccountContract {
}

fn __execute__(ref self: ContractState, calls: Array<Call>) -> Array<Span<felt252>> {
panic!("EOA: __execute__ not supported");
array![]
panic!("EOA: __execute__ not supported")
}

fn write_bytecode(ref self: ContractState, bytecode: Span<u8>) {
Expand Down
23 changes: 22 additions & 1 deletion crates/contracts/tests/test_execution_from_outside.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,31 @@ fn test_execute_from_outside_should_fail_with_zero_calls() {
tear_down(contract_account);
}

#[test]
#[should_panic(expected: 'EOA: cannot have code')]
fn test_execute_from_outside_should_fail_account_with_code() {
let (kakarot_core, contract_account, _) = set_up();

let outside_execution = OutsideExecutionBuilderTrait::new(kakarot_core.contract_address)
.build();
let signature = PLACEHOLDER_SIGNATURE.span();

let _ = contract_account.execute_from_outside(outside_execution, signature);

tear_down(contract_account);
}


#[test]
#[should_panic(expected: 'KKRT: Multicall not supported')]
fn test_execute_from_outside_should_fail_with_multi_calls() {
let (kakarot_core, contract_account, _) = set_up();
let (kakarot_core, _, _) = set_up();

let contract_address = deploy_contract_account(
kakarot_core, other_evm_address(), counter_evm_bytecode()
)
.starknet;
let contract_account = IAccountDispatcher { contract_address };

let outside_execution = OutsideExecutionBuilderTrait::new(kakarot_core.contract_address)
.with_calls(
Expand Down

0 comments on commit daf20b0

Please sign in to comment.