You can find complete writeups for this challenge elsewhere but come here if you need just a little nudge!
I completed the challenges using hardhat and ethers.js library which has most of the stuff you’ll need.
Just call contract.guess(42), uh.
You can actually reverse a hash when the input value was a small number…
Remember, all data on the chain is public. ethers.js provides a function to read that data too.
Can just brute-force it. Or use the method from the next challenge.
If only you could execute some code on chain to check the guess number …
Like for any security work, make sure you are aware of the edge cases of APIs!
It should be quite obvious this will be about overflows.
A business logic bug.
Look carefully if the right variables are in the right places.
You’ll probably find the middle step you need to get to. To get there, need to be familiar with edge case behaviour of Solidity. It’s in the docs.
Sometimes Solidity can be like C, lol
Don’t forget about the overflows either.
This one is not that obvious but it’s documented in SWC.
If you look closely, there’s something weird or funny in the code.
Where?
Well, similar problem to last challange but not the same.
BTW it doesn’t compile in newer versions of Solidity.
And then you can use that bug to get to the end.
There are probably two ways to solve this but both will involve some spinning fans.
Again, read the docs.
There is literally a function for this in ethers.js as well as in solidity / EVM!
Ok here is where you need to bring your cryptography knowledge about signatures, Sony etc.
Yeah this bug doesn’t exist in new version of Solidity any more.
Was it Parity who got burned on that? Anyway …
This classic bug should also be in the challenge!
