1// SPDX-License-Identifier: Unlicense2pragma solidity ^0.8.17;3
4import {IPuzzle} from "../interfaces/IPuzzle.sol";5
6/// @title TinySig7/// @author Riley Holterhus8contract TinySig is IPuzzle {9
10 // This is the address you get by using the private key 0x1.11 // For this challenge, make sure you do not use *your own* private key12 // (other than to initiate the `solve` transaction of course). You only13 // need to use the private key 0x1 for signing things.14 address constant SIGNER = 0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf;15
16 /// @inheritdoc IPuzzle17 function name() external pure returns (string memory) {18 return "TinySig";19 }20
21 /// @inheritdoc IPuzzle22 function generate(address _seed) external view returns (uint256) {23 return uint256(keccak256(abi.encodePacked(_seed)));24 }25
26 /// @inheritdoc IPuzzle27 function verify(uint256 _start, uint256 _solution) external returns (bool) {28 address target = address(new Deployer(abi.encodePacked(_solution)));29 (, bytes memory ret) = target.staticcall("");30 (bytes32 h, uint8 v, bytes32 r) = abi.decode(ret, (bytes32, uint8, bytes32));31 return (32 r < bytes32(uint256(1 << 184)) &&33 ecrecover(h, v, r, bytes32(_start)) == SIGNER34 );35 }36}37
38contract Deployer {39 constructor(bytes memory code) { assembly { return (add(code, 0x20), mload(code)) } }40}41
Time Left
Solve locally (WIP)
- Clone GitHub repo + install deps
git clone https://github.com/waterfall-mkt/curta-puzzles.git && cd curta-puzzles && forge install
- Set
RPC_URL_MAINNET
in.env
.env
RPC_URL_MAINNET=""
- Write solution + run script
forge script <PATH_TO_PUZZLE> -f mainnet -vvv
This is still WIP.