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

updateStreamInternal does not need msg.sender #167

Closed
code423n4 opened this issue Dec 6, 2021 · 1 comment
Closed

updateStreamInternal does not need msg.sender #167

code423n4 opened this issue Dec 6, 2021 · 1 comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Handle

bitbopper

Vulnerability details

Impact

Uneeded msg.sender creating gas cost in Line:
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L203

Proof of Concept

Remove msg.sender from updateStream and updateStreamInternal like so and modify all callers


    modifier updateStream() {
        // save bytecode space by making it a jump instead of inlining at cost of gas
        updateStreamInternal();
        _;
    }

    function updateStreamInternal() internal {

Saved ~8k gas during tests calling stake
in tests with DAPP_BUILD_OPTIMIZE=1 DAPP_BUILD_OPTIMIZE_RUNS=9999999

Tools Used

dapptools

Recommended Mitigation Steps

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Dec 6, 2021
code423n4 added a commit that referenced this issue Dec 6, 2021
@0xean
Copy link
Collaborator

0xean commented Jan 17, 2022

dupe of #125

@0xean 0xean closed this as completed Jan 17, 2022
@0xean 0xean added duplicate This issue or pull request already exists 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments and removed G (Gas Optimization) labels Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants