-
Notifications
You must be signed in to change notification settings - Fork 48
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
Test deploy cheatcode #2132
Test deploy cheatcode #2132
Conversation
Co-authored-by: karol-bisztyga <[email protected]>
PreparedContract { | ||
class_hash, | ||
constructor_calldata: @calldata, | ||
contract_address: 'addr' |
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.
So deploy will use whatever contract address it gets passed?
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 sir
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.
As you can see here
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.
Would be nice if he had some simplification here so user can write something like this
PreparedContract::from_class_hash(class_hash);
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.
Ideally user would use deploy_contract
for the simplest flow
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.
Ideally user would use deploy_contract for the simplest flow
I think deploy_contract will be obsolete when we remove declare
cheatcode, and predeclare all contracts instead
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.
Was not aware of such idea, fair point. Although this is out of scope for this PR.
Could we add a task to extend those test when |
You can add a comment to #1991 |
|
||
let contract_address = deploy( | ||
PreparedContract { | ||
class_hash, |
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.
What will happen if non-existing class_hash is passed?
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.
I guess panic, but this can be tested
let contract_address = deploy( | ||
PreparedContract { | ||
class_hash, | ||
constructor_calldata: @calldata, |
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.
What will happen if error is raised by the constructor?
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.
Are we sure constructor is executed, can we have test case for that?
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.
What will happen if error is raised by the constructor
For now it panics, but it's not the target behavior
Are we sure constructor is executed, can we have test case for that?
OK.
This one is on hold until we figure out a smart way to write tests |
Checklist
Closes #2108
Note:
Not much more can be tested ATM to be honest