Skip to content
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

[IPool] - _setDesiredDenorm in memory record update serves no purpose #10

Closed
cleanunicorn opened this issue Oct 12, 2020 · 1 comment
Closed
Labels

Comments

@cleanunicorn
Copy link
Member

cleanunicorn commented Oct 12, 2020

Description

The method _setDesiredDenorm sets a desired denorm on the specified token. It first caches the record to the memory.

  function _setDesiredDenorm(address token, uint96 desiredDenorm) internal {
    Record memory record = _records[token];

And later it updates the desiredDenorm on the in-memory structure.

    record.desiredDenorm = desiredDenorm;

However this structure is never used after the update, and at the end of the method execution, the whole structure is discarded. Thus making the update useless.

Recommendation

Remove the line that updates desiredDenorm.

@cleanunicorn cleanunicorn changed the title [IPool] - _setDesiredDenorm in memory record update is useless [IPool] - _setDesiredDenorm in memory record update serves no purpose Oct 21, 2020
@d1ll0n
Copy link
Collaborator

d1ll0n commented Oct 22, 2020

Addressed in indexed-finance/indexed-core#27

Code reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants