-
Notifications
You must be signed in to change notification settings - Fork 358
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
Simplify paths for fetching contract classes in tests #377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left small comments, great improvement!
tests/security/test_initializable.py
Outdated
|
||
signer = MockSigner(12345678987654321) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it's not!
@@ -11,7 +11,7 @@ | |||
async def reentrancy_mock(): | |||
starknet = await Starknet.empty() | |||
contract = await starknet.deploy( | |||
"tests/mocks/reentrancy_mock.cairo", | |||
contract_class=get_contract_class("reentrancy_mock"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how was this working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the contract_class
kwarg, you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
account_cls = get_contract_class('Account') | ||
erc721_cls = get_contract_class('ERC721_Mintable_Burnable') | ||
erc721_holder_cls = get_contract_class('ERC721_Holder') | ||
unsupported_cls = get_contract_class('Initializable') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Martín Triay <martriay@gmail.com>
This PR proposes to simplify getting contract classes in the test environment. Instead of passing the entire path as an argument to
get_contract_class
, this PR proposes to pass just the contract name. For example:as opposed to:
In the event that multiple preset contracts share the same name,
get_contract_class
includes the optional paramis_path
. The syntax looks like this:Resolves #379.