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

Fix setup.cfg version #406

Merged
merged 5 commits into from
Jul 26, 2022
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 setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = openzeppelin-cairo-contracts
version = attr: openzeppelin-cairo-contracts.__version__
version = attr: openzeppelin.__version__
description = Library for secure smart contract development written in Cairo
author = OpenZeppelin Community
author_email = [email protected]
Expand Down
20 changes: 11 additions & 9 deletions tests/account/test_EthAccount.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pytest
from starkware.starknet.testing.starknet import Starknet
from starkware.starkware_utils.error_handling import StarkException
from starkware.starknet.definitions.error_codes import StarknetErrorCode
from utils import assert_revert, get_contract_class, cached_contract, TRUE, FALSE
from signers import MockEthSigner

Expand Down Expand Up @@ -92,7 +90,8 @@ async def test_execute(account_factory):

# should revert if signature is not correct
await assert_revert(
signer.send_transactions(account, [(account.contract_address, 'is_valid_signature', [hash-1, len(signature), *signature])]),
signer.send_transactions(account, [(account.contract_address, 'is_valid_signature', [
hash-1, len(signature), *signature])]),
reverted_with="Invalid signature"
)

Expand Down Expand Up @@ -136,22 +135,24 @@ async def test_return_value(account_factory):
@ pytest.mark.asyncio
async def test_nonce(account_factory):
account, _, initializable, *_ = account_factory
# bump nonce

# bump nonce
await signer.send_transactions(account, [(initializable.contract_address, 'initialized', [])])

execution_info = await account.get_nonce().call()
current_nonce = execution_info.result.res

# lower nonce
await assert_revert(
signer.send_transactions(account, [(initializable.contract_address, 'initialize', [])], current_nonce - 1),
signer.send_transactions(
account, [(initializable.contract_address, 'initialize', [])], current_nonce - 1),
reverted_with="Account: nonce is invalid"
)

# higher nonce
await assert_revert(
signer.send_transactions(account, [(initializable.contract_address, 'initialize', [])], current_nonce + 1),
signer.send_transactions(
account, [(initializable.contract_address, 'initialize', [])], current_nonce + 1),
reverted_with="Account: nonce is invalid"
)

Expand Down Expand Up @@ -195,9 +196,10 @@ async def test_account_takeover_with_reentrant_call(account_factory):
account, _, _, _, attacker = account_factory

await assert_revert(
signer.send_transaction(account, attacker.contract_address, 'account_takeover', []),
signer.send_transaction(
account, attacker.contract_address, 'account_takeover', []),
reverted_with="Account: no reentrant call"
)

execution_info = await account.get_eth_address().call()
assert execution_info.result == (signer.eth_address,)