-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor!: separate Contract
loading and deploying
#899
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.
Left a suggestion.
Love it.
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 think the approach of making CompiledContract
a good type would improve UX vastly as you did, without loosing semantic richness
I did consider that approach. However, |
After doing some testing, I realize you are right, it does feel like we're just passing things around. I withdraw my remark, but I feel like my confusion arises from the fact that we are not distinguishing between a |
🙏 🙏 please keep this PR down to a single change. A PR should only fix one thing or introduce one feature, not do two things at the same time. |
I'm not sure I follow here. From my perspective, they are the same object (albeit not instance), a deployed contract. The difference is only the |
Contract
loading and deploying
we agreed to change how the contract is loaded and deployed
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Contract
loading and deploying Contract
loading and deploying
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.
This is an amazing UX improvement; the previous way of loading + deploying was getting way too convoluted. Super clean implementation, too; great stuff, @hal3e.
Approving a minor grammar-related change request, feel free to merge after!
Co-authored-by: Rodrigo Araújo <rod.dearaujo@gmail.com>
c443c5a
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.
awesome work!
closes: #892
Updated PR description
After taking in consideration all comments made in this PR, I have decided to do a bit more refactoring on
Contract
. I have tried to move functions not related directly toContract
to places where they make more sense. I have:contract_deployment_transaction
toCreateTransactionBuilder::prepare_contract_deployment
get_storage_slots
and its logic toStorageConfiguration
- No need forContract
to handle thisvalidate_path_and_extension
outside as it is now also used byStorageConfiguration
method_hash
andshould_compute_custom_input_offset
- No need forContract
to handle thisdeploy
and renameddeploy_loaded
todeploy
- big breaking change will elaborate belowOther refactors:
DeployConfiguration
intoLoadConfiguration
and took outTxParametres
TxParameters
when he actually deploy the contractThe biggest change for the user is the way to deploy contracts. Previously the user would use
deploy
directly:This function basically did two things: Load and then deploy the contract. I propose we use this instead:
This makes it clear what is being done. Makes the
LoadConfiguration
simpler and also now the user can get thecontract_id
orstate_root
easily.For reference this is what the user had to do previously to get the
contract_id
thanks @segfault-magnet for your suggestions and helping me move code around 😄
Checklist