Puzzle #6
Uncertainty Principle
Author
0xbad58e133138549936d2576ebc33251be841d3e9
wei3erhase.eth
SoliditySolidity's logo.Puzzle
Curtacallsverify()
1
// SPDX-License-Identifier: Unlicense
2
pragma solidity ^0.8.17;
3
4
import {IPuzzle} from "./interfaces/IPuzzle.sol";
5
6
/**
7
* @title Touring-Heisenberg Uncertainty Principle
8
* @author wei3erHase
9
*/
10
contract EventHorizon is IPuzzle {
11
12
/// @inheritdoc IPuzzle
13
string constant public name = "Uncertainty Principle";
14
15
uint256 constant PLANK_CONSTANT = 0x111; // 1 in XYZ
16
uint256 constant PLANK_LENGTH = 0xF;
17
uint256 constant PHISICAL_SPHERE = type(uint32).max;
18
19
/// @inheritdoc IPuzzle
20
function generate(address _seed) external view returns (uint256) {
21
return _gammaFn(uint256(uint160(_seed))) | PLANK_CONSTANT;
22
}
23
24
/// @inheritdoc IPuzzle
25
function verify(uint256 _start, uint256 _solution) external view returns (bool) {
26
uint256 _axis;
27
uint256 _momentum;
28
uint256 _position;
29
30
unchecked {
31
while (_start & PHISICAL_SPHERE > 0) {
32
_position = _axis++ * 4;
33
_momentum = _gammaFn(_solution) & PLANK_LENGTH << _position;
34
for (uint256 _i; _i < _momentum >> _position; _i++) {
35
continue;
36
}
37
_start -= _momentum;
38
}
39
}
40
41
return true;
42
}
43
44
function _gammaFn(uint256 _xyz) internal view returns (uint256) {
45
/// @notice gasleft() has a directional preference (as entropy)
46
return uint256(keccak256(abi.encodePacked(_xyz, gasleft())));
47
}
48
}
49
First Blood
chainlight.io
02:06:12
18
Time Left

Solve locally (WIP)

  1. Clone GitHub repo + install deps
git clone https://github.com/waterfall-mkt/curta-puzzles.git && cd curta-puzzles && forge install
  1. Set RPC_URL_MAINNET in .env
.env
RPC_URL_MAINNET=""
  1. Write solution + run script
forge script <PATH_TO_PUZZLE> -f mainnet -vvv
This is still WIP.
Waterfall