Puzzle #13
Ping Pong
SoliditySolidity's logo.Puzzle
Curtacallsverify()
1
// SPDX-License-Identifier: MIT
2
pragma solidity ^0.8.18;
3
4
interface IStarknetCore {
5
function consumeMessageFromL2(uint256, uint256[] calldata)
6
external
7
returns (bytes32);
8
}
9
10
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
11
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
12
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
13
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
14
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
15
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
16
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
17
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
18
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
19
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
20
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
21
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
22
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
23
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
24
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
25
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
26
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
27
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
28
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
29
// ping pong ping pong ping pong ping pong ping pong ping pong ping pong ping pong
30
31
/// @title PingPong
32
/// @author exp.table
33
contract PingPong {
34
35
IStarknetCore constant starknetCore = IStarknetCore(0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4);
36
uint256 constant pong = 0x012d8ab4947254afb512883d7d768d17436c9057a1ae21e53389603266c397f7;
37
address a;
38
39
constructor(bytes memory bytecode) {
40
assembly {
41
sstore(a.slot, create(0, add(bytecode, 0x20), mload(bytecode)))
42
}
43
}
44
45
function name() external pure returns (string memory) {
46
return "Ping Pong";
47
}
48
49
function generate(address _seed) external view returns (uint256) {
50
return uint256(keccak256(abi.encodePacked(_seed, block.number)));
51
}
52
53
function verify(uint256 _start, uint256 _solution) external returns (bool success) {
54
uint256[] memory payload = new uint256[](3);
55
payload[0] = _start >> 128;
56
payload[1] = _start & 340282366920938463463374607431768211455;
57
payload[2] = _solution;
58
59
starknetCore.consumeMessageFromL2(pong, payload);
60
61
(, bytes memory result) = a.call(abi.encode(_solution));
62
success = abi.decode(result, (bool));
63
}
64
65
function gist() external pure returns (string memory) {
66
return "9761e3575eb6439a1fab1d834ddc18aa";
67
}
68
}
First Blood
eoa.sina.eth
13:43:24
12
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