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

circuitBreaker overrides the state #38

Open
code423n4 opened this issue Jun 14, 2021 · 1 comment
Open

circuitBreaker overrides the state #38

code423n4 opened this issue Jun 14, 2021 · 1 comment

Comments

@code423n4
Copy link
Contributor

Handle

pauliax

Vulnerability details

Impact

function circuitBreaker calls _incrementState but later sets the state itself again:
function _incrementState() internal {
assert(uint256(state) < 4);
state = States(uint256(state) + (1));
emit LogStateChange(uint256(state));
}

function circuitBreaker() external {
    require(
        block.timestamp > (uint256(oracleResolutionTime) + (12 weeks)),
        "Too early"
    );
    _incrementState();
    orderbook.closeMarket();
    state = States.WITHDRAW;
}

Recommended Mitigation Steps

state = States.WITHDRAW; shouldn't be there, or another solution would be to put it before orderbook.closeMarket(); and remove _incrementState(); instead but then LogStateChange event will also need to be emitted manually.

@code423n4 code423n4 added 0 (Non-critical) bug Something isn't working labels Jun 14, 2021
code423n4 added a commit that referenced this issue Jun 14, 2021
@Splidge
Copy link
Collaborator

Splidge commented Jun 21, 2021

implemented here

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

No branches or pull requests

2 participants