ethernaut
ethernaut copied to clipboard
Solidity 0.5 Version: Levels marked as `Completed` when not attempted
Reported by a community member via email:
Levels 10 and 11 show as 'Completed' with blue ticks in front of them when they had not been attempted in the Solidity 0.5 Version. Refreshing and hard-refreshing, as well as disabling and re-enabling MetaMask plugin did not resolve.
I have seen something similar previously but haven't been able to reproduce.
Same happened to me, Token and Delegation appeared as completed after I solved Telephone :thinking:
I now have a number of levels showing as completed:
- Re-entrancy ✔
- Elevator ✔
- Privacy ✔
- Gatekeeper One
- Gatekeeper Two ✔
- Naught Coin ✔
- Preservation ✔
- Recovery ✔
- MagicNumber ✔
- Alien Codex
- Denial ✔
- Shop
I'm trying to track this down.
Completed levels are tracked in LocalStorage (see https://github.com/OpenZeppelin/ethernaut/blob/solidity-05/src/reducers/playerReducer.js#L36-L62). Removing the level from LocalStorage manually puts things back to normal.
The SUBMIT_LEVEL_INSTANCE
action is triggered here by a listener: https://github.com/OpenZeppelin/ethernaut/blob/solidity-05/src/middlewares/syncPlayerProgress.js#L16-L41. So my first guess is that there's something going on with the event being watched, that may be triggering the action which sets the level as completed. Here we can see which changes suffered after the PR updating to Solidity 0.5: https://github.com/OpenZeppelin/ethernaut/pull/151/files#diff-a0fd93803dc376f8b086ec3611f9ad88
By I still haven't figured the why.
I seem to have found the culprit. In https://github.com/OpenZeppelin/ethernaut/blob/solidity-05/src/middlewares/syncPlayerProgress.js#L16-L18 we don't seem to be filtering appropriately. According to https://web3js.readthedocs.io/en/v1.2.2/web3-eth-contract.html#contract-events, we should be doing:
const log = state.contracts.ethernaut.LevelCompletedLog(
{ filter: { player: state.player.address } }
);
Closing since it's fixed