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

[CodeArena] - [G-26] : Remove double reading of state variable #78

Merged
merged 1 commit into from
Jan 5, 2022

Conversation

maximebrugel
Copy link
Contributor

@maximebrugel maximebrugel added the To review Let people know this PR is ready for a review label Dec 21, 2021
@adrien-supizet
Copy link
Contributor

I see the issue is marked question did you figure out the answer?

@adrien-supizet adrien-supizet removed the To review Let people know this PR is ready for a review label Dec 22, 2021
@maximebrugel
Copy link
Contributor Author

I see the issue is marked question did you figure out the answer?

@adrien-supizet no, the auditor is anon 🤷🏻‍♂️ (impossible to reach)

@maximebrugel
Copy link
Contributor Author

@adrien-supizet Should we try to get an answer or skipping this part of the issue ?

@maximebrugel maximebrugel added the Draft Do not merge label Dec 22, 2021
@adrien-supizet
Copy link
Contributor

@adrien-supizet Should we try to get an answer or skipping this part of the issue ?

If you kind of understand the issue mentioned, let's discuss it and try to figure it out. Otherwise let's skip it.

@maximebrugel
Copy link
Contributor Author

maximebrugel commented Dec 23, 2021

Just found out :

 for (uint256 i = 0; i < requiredAddresses.length; i++) {
    bytes32 name = requiredAddresses[i];    
    // Note: can only be invoked once the resolver has all the targets needed added     
    address destination = resolver.getAddress(name);
    if (destination != address(0)) {
        addressCache[name] = destination;
    } else {
        delete addressCache[name];
    }
    emit CacheUpdated(name, destination);
}

We must extract the variable name and destination (to be declared once outside of the loop).

@maximebrugel maximebrugel added Fix and merge Minor changes required Changes required Second review needed after changes and removed Draft Do not merge Fix and merge Minor changes required labels Jan 2, 2022
@maximebrugel
Copy link
Contributor Author

@adrien-supizet The rebuildCache fix is already done => #61

Just also extracted address cacheTmp;. it can be reviewed.

@maximebrugel maximebrugel added To review Let people know this PR is ready for a review and removed Changes required Second review needed after changes labels Jan 3, 2022
@adrien-supizet adrien-supizet added Can merge Good to go and removed To review Let people know this PR is ready for a review labels Jan 5, 2022
@maximebrugel maximebrugel merged commit 4839a17 into codearena Jan 5, 2022
@maximebrugel maximebrugel deleted the codearena-98 branch January 5, 2022 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can merge Good to go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants