-
Notifications
You must be signed in to change notification settings - Fork 191
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(zoe): Replace arrayToObj with objectMap #8856
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.
I'll wait until this is ready for review before doing a more careful read. But looks good to me so far. A welcome simplification!
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.
Please do fix all the imports of this. Thanks.
There is a test failure in dapp-card-store integration caused by promise chains internal to |
e196e2a
to
2006618
Compare
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
7ca9f5d
to
726c44d
Compare
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 mechanical to me.
The disjointness of keywords will remain. So under that assumption, this indeed has no observable change. But it is more robust to possible future design changes as well as lack-of-enforcement errors. Re "yesterday's discussion", I think that had to do with a restriction on having the "same" asset in give and want, for some def of "same" I cannot recall. In any case, @Chris-Hibbert is not finding that so my memory is likely confused. In any case, the problem we wanted to solve by lifting this (possibly non-existent) check would not be addressed by relaxing the disjoint keyword prohibition. They're independent. In any case, still LGTM. Please proceed. |
…before give properties This currently has no significant effect because cleanProposal uses assertKeywordNotInBoth to guarantee disjoint keywords, but we should not overwrite give amounts when/if that constraint is removed.
726c44d
to
2165e1e
Compare
Most of this is a clean refactor. The code added in 726c44d looks like a semantic change. I'm going to add it to my list to be included in upgrade 16. |
Description
arrayToObj
is an old function and has significant overlap withobjectMap
(the latter is basicallyObject.fromEntries(Object.entries(obj).map(([key, value]) => [key, mapFn(value, key)]))
, and the former is basicallyObject.fromEntries(zip(keys, values))
where values comes from manually mapping over original values).This PR removes it in favor of more idiomatic code.
Security Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
Probably none; no new code is using the affected functions.
Testing Considerations
All remaining tests should continue to pass.
Upgrade Considerations
n/a; behavior is unaffected