-
Notifications
You must be signed in to change notification settings - Fork 7
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
263 add optimizations audit recommendations #392
Conversation
…ons was removed so no need to change there, makes use of get_transactions
…ets, cannot modify like proposed.
… are left as generic so to avoid the need of a second map and filter/transform can be done in one iterator
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 looked through the changes and think you did a great job @gianfra-t. I left some nitpicky comments but also one more severe issue related to changes for 'LBS-01 - Duplicated condition check'. At least I think it is, let me know your thoughts.
…passed to drain expired() does hold active requests after execution now.
Regarding LBS-01 (090c314), I understood that |
Never Mind, it is matching |
Exactly. A small but important difference. I thought I left a review comment on that specific line but maybe I accidentally discarded it again. At least I can't find it anymore haha. |
remove empty line Co-authored-by: Marcel Ebert <mail@marcel-ebert.de>
remove empty line Co-authored-by: Marcel Ebert <mail@marcel-ebert.de>
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 to me overall. Please install the pre-commit hook and also run cargo fmt --all
to make sure that the CI does not complain (which it will because of this). You can then turn the PR from 'draft' to 'ready for review' and once CI passed, I'll approve :)
@gianfra-t the CI job threw some warning because clippy failed, can you please add the suggested change and re-run the job? |
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.
LGTM and ready for merge
Some notable mentions:
LIY-04/LIT-05 was already solved since audit.
LIV-01 "Duplicated Helper Function Call" -> I left this unchanged. In my opinion cannot be optimized without modifying (splitting)
try_deposit_collateral
from pallet vault-registry. Although indeposit_collateral
extrinsic it is duplicated the active vault check, this function is used also externally outside the pallet.IMP-02 "Empty Strings as prefixes" -> I also left this unchanged. I believe this could be useful in the future, since it is already coded and works, for extension purposes.
HOR-01/HOI-01 Unnecessary Variable cloning -> the code seems to have changed since then. Couldn't find that specific reference.
EXC-02/EXU-03 Double filter() calls can be reduced with filter_map() -> Is addressed along with RPC-01, where the use of closures filter and transform the into
Request
type inside bothget_vault_redeem_requests
andget_old_vault_replace_requests
.