-
Notifications
You must be signed in to change notification settings - Fork 267
feat: be explicit about detached Promises
#1400
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1400 +/- ##
==========================================
- Coverage 80.68% 80.68% -0.01%
==========================================
Files 106 106
Lines 15514 15539 +25
==========================================
+ Hits 12518 12537 +19
- Misses 2996 3002 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
frol
left a comment
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 a nice and elegant solution. Thank you for contributing it!
@race-of-sloths score 5
|
@mitinarseny Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 5! @frol received 25 Sloth Points for reviewing and scoring this pull request. We would appreciate your feedback or contribution idea that you can submit here What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
This PR annotates
Promise,ConcurrentPromisesandPromiseOrValuewith#[must_use], so that contract devs should be explicit about detaching them.In general, detached
Promises should be discouraged from use, as it ruins composability between different smart-contracts. There still are cases where it's ok to detach, but for the majority of them is a bad design choice. For example, it's currently impossible for a contract to safely refundstorage_depositon some token to the owner of this contract without relying on some trusted party or oracle:So, it makes sense to add this hint for contract developers to prevent them from misusing this detached functionality.