Skip to content

Commit 6299bfa

Browse files
committed
failed test case
1 parent 0391b35 commit 6299bfa

File tree

3 files changed

+68
-9
lines changed

3 files changed

+68
-9
lines changed

pyproject.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,16 @@ setuptools = "^70.3.0"
5656
test = [
5757
"clean_coverage",
5858
"test_ci_v1 --disable-warnings -qq",
59-
"test_ci_v2 --disable-warnings -qq",
60-
"test_ci_on_networks --disable-warnings -qq",
61-
"test_ci_docs_v1 --disable-warnings -qq",
62-
"test_ci_docs_v2 --disable-warnings -qq",
63-
"test_report --skip-covered"
59+
# "test_ci_v2 --disable-warnings -qq",
60+
# "test_ci_on_networks --disable-warnings -qq",
61+
# "test_ci_docs_v1 --disable-warnings -qq",
62+
# "test_ci_docs_v2 --disable-warnings -qq",
63+
# "test_report --skip-covered"
6464
]
6565

6666
test_ci = ["test_ci_v1", "test_ci_v2"]
67-
test_ci_v1 = "coverage run -a -m pytest --contract_dir=v1 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/tests_on_networks"
67+
test_ci_v1 = "coverage run -a -m pytest --contract_dir=v1 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/tests_on_networks starknet_py/tests/e2e/account"
68+
# test_ci_v1 = "coverage run -a -m pytest --contract_dir=v1 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/tests_on_networks"
6869
test_ci_v2 = "coverage run -a -m pytest --contract_dir=v2 starknet_py --ignore=starknet_py/tests/e2e/docs --ignore=starknet_py/tests/e2e/tests_on_networks"
6970

7071
test_ci_on_networks = "coverage run -a -m pytest --contract_dir=v2 starknet_py/tests/e2e/tests_on_networks"

starknet_py/net/account/base_account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def sign_outside_execution_call(
6262
supports and use the highest one and populate the value.
6363
"""
6464

65-
class BaseAccount(ABC):
65+
class BaseAccount(SNIP9SupportMixin, ABC):
6666
"""
6767
Base class for all account implementations.
6868

starknet_py/tests/e2e/account/account_test.py

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
MAX_RESOURCE_BOUNDS,
4242
MAX_RESOURCE_BOUNDS_L1,
4343
)
44+
from starknet_py.transaction_errors import (
45+
TransactionRevertedError,
46+
)
4447

4548

4649
@pytest.mark.run_on_devnet
@@ -857,7 +860,7 @@ async def test_account_execute_v3(account, deployed_balance_contract):
857860
assert initial_balance + 100 == balance_after_increase
858861

859862
@pytest.mark.asyncio
860-
async def test_account_outside_execution(
863+
async def test_account_outside_execution_any_caller(
861864
client,
862865
argent_account_class_hash,
863866
deployed_balance_contract,
@@ -890,7 +893,7 @@ async def test_account_outside_execution(
890893
calldata=[100],
891894
)
892895

893-
call = await account.sign_execute_outside_call(
896+
call = await account.sign_outside_execution_call(
894897
calls=[
895898
increase_balance_call,
896899
increase_balance_call,
@@ -905,3 +908,58 @@ async def test_account_outside_execution(
905908

906909
tx = await account.execute_v1(calls=[call], max_fee=MAX_FEE)
907910
await account.client.wait_for_tx(tx.transaction_hash)
911+
912+
913+
@pytest.mark.asyncio
914+
async def test_account_outside_execution_for_invalid_caller(
915+
client,
916+
argent_account_class_hash,
917+
deployed_balance_contract,
918+
deploy_account_details_factory,
919+
):
920+
address, key_pair, salt, class_hash = await deploy_account_details_factory.get(
921+
class_hash=argent_account_class_hash, argent_calldata=True
922+
)
923+
924+
deploy_result = await Account.deploy_account_v1(
925+
address=address,
926+
class_hash=class_hash,
927+
salt=salt,
928+
key_pair=key_pair,
929+
client=client,
930+
constructor_calldata=[key_pair.public_key, 0],
931+
max_fee=MAX_FEE,
932+
)
933+
await deploy_result.wait_for_acceptance()
934+
account = deploy_result.account
935+
936+
assert any([
937+
await account.supports_interface(SNIP9InterfaceVersion.V1),
938+
await account.supports_interface(SNIP9InterfaceVersion.V2),
939+
])
940+
941+
increase_balance_call = Call(
942+
to_addr=deployed_balance_contract.address,
943+
selector=get_selector_from_name("increase_balance"),
944+
calldata=[100],
945+
)
946+
947+
call = await account.sign_outside_execution_call(
948+
calls=[
949+
increase_balance_call,
950+
increase_balance_call,
951+
increase_balance_call,
952+
],
953+
execution_time_bounds=ExecutionTimeBounds(
954+
execute_after=datetime.datetime.now() - datetime.timedelta(hours=1),
955+
execute_before=datetime.datetime.now() + datetime.timedelta(hours=1),
956+
),
957+
caller=deployed_balance_contract.address,
958+
)
959+
960+
tx = await account.execute_v1(calls=[call], max_fee=MAX_FEE)
961+
962+
with pytest.raises(TransactionRevertedError) as err:
963+
await account.client.wait_for_tx(tx.transaction_hash)
964+
965+
assert 'argent/invalid-caller' in err.value.message

0 commit comments

Comments
 (0)