Puzzle #16
Elohim
Author
0xe7aa7af667016837733f3ca3809bde04697730ef
devtooligan.eth
SoliditySolidity's logo.Puzzle
Curtacallsverify()
1
// SPDX-License-Identifier: UNLICENSED
2
pragma solidity ^0.8.20;
3
import {IPuzzle} from "curta/src/interfaces/IPuzzle.sol";
4
5
// NOTE: This is PUZZLE.SOL file -- NERVCommand.huff file is concatenated below.
6
// Find both files and a working example at : https://github.com/devtooligan/curta-elohim
7
8
/**
9
* () ^^ - ( )-
10
* | v ' / | \ `
11
* //****\\ .
12
* =======// * * \\====== <
13
* ///===\ //\\____// ===\\\ . ^ ^
14
* ||| \| |/ \\\
15
* ||| | O---O | \\\___.... . . .
16
* ||| | - | \\\///oo///=-=-=-*>*>*>
17
* X|X | | XX|X===////'' : ' ( ` /
18
* ()||\ | O---O | ^^^^ _________ * _|
19
* | / \ // /\ \\ | o o o o | **__/||\_
20
* \\ \ \ \\ ____ | o o o o |___ ** O O |
21
* \\ \ \ || |o o| /|==| o o o o | - |____ | O O |
22
* || || \ || |o o| /=| | o o o o | - | == || O O |
23
* /_____\ /_____\ | |/ | | o ||| o | | = || |^|^| |\
24
*
25
* Elohim: The Fifth Impact
26
* =====================================
27
*
28
* In the looming shadow of impending annihilation, humanity confronts an unparalleled menace
29
* — the Elohim. These warrior angels wield weapons of insurmountable destruction and can
30
* communicate with their hive through their ethereal antennae. A single Elohim scout has
31
* arrived on Earth signaling the ominous advance of an entire fleet, poised to unleash the
32
* cataclysmic Fifth Impact upon our world.
33
*
34
* From the depths of NERV Command, a beacon of hope emerges: Eva Units Seven, Eight, Nine,
35
* and Ten. These quantum-linked marvels of technology, can synchronize under the command of a
36
* single pilot.
37
*
38
* Now the destiny of Tokyo-3 and all of Earth hinges upon you, pilot.
39
*
40
* Can you master the four Evas, quell the Elohim threat, and unlock their DNA sequence to
41
* halt the impending invasion?
42
*
43
* In this climactic clash of unity and chaos, where humanity's essence is laid bare, the
44
* moment has arrived to brave the unknown. Are you prepared to become the savior, our final
45
* hope in the darkest hour?
46
*
47
* The Fifth Impact looms, and the ultimate battle ignites.
48
*/
49
50
contract Puzzle is IPuzzle {
51
error QuantumOpcodeError(bytes1 opcode);
52
53
address public NERV;
54
address internal impl;
55
address internal immutable addressThis;
56
address internal immutable owner;
57
58
constructor(address nerv_) {
59
NERV = nerv_;
60
impl = address(this);
61
addressThis = address(this);
62
owner = msg.sender;
63
}
64
65
////////////////////////////////////////////////////////////////////////////////////////
66
// CORE PILOT FUNCTIONS //
67
////////////////////////////////////////////////////////////////////////////////////////
68
69
function name() external pure returns (string memory) {
70
return "Elohim";
71
}
72
73
/// @dev This function returns the pilot's account address.
74
function generate(address _seed) external pure returns (uint256) {
75
return uint160(_seed);
76
}
77
78
function verify(uint256 pilotAddress, uint256 input) external view returns (bool worldSaved) {
79
return Puzzle(impl)._verify(pilotAddress, input);
80
}
81
82
function _verify(uint256 pilotAddress, uint256 input) external view returns (bool worldSaved) {
83
/******************************* input ***************************************************
84
** | Evangelion | Eva | Elohim DNA | Simulator **
85
** | Control Address | Config | Prediction | Difficulty **
86
** 0x 00112233445566778899AABBCCDDEEFF00112233 A1A2A3A3 AAAAAAAAAAAAAA 18 **
87
*****************************************************************************************/
88
require(msg.sender == addressThis, "ser, this is a wendy's");
89
address pilot = address(uint160(pilotAddress));
90
91
/** Simulator Difficulty */
92
uint8 difficulty = uint8(input);
93
_validateSimulatorDifficulty(difficulty, pilot);
94
95
/** Elohim DNA
96
It's up to you to develop an algorithm that can predict the Elohim's DNA sequence in
97
advance. If you can do it, we can develop genetic weaponry to take on the invaders and
98
we just might have a chance at saving the world. */
99
uint56 dnaVerification = uint56(uint256(input >> 8));
100
101
/** Eva Config
102
The Eva configuration is based on a combination of the pilot's DNA and time-dependent
103
environmental factors. These settings must be used in the submitted input, pilot. */
104
uint256 config = (input & CONFIG_MASK) >> 64;
105
if (generateEvaConfig(pilot, difficulty) != config) revert("invalid eva config");
106
uint256[] memory configVals = new uint256[](4);
107
for (uint256 idx; idx < 4; ++idx) {
108
configVals[idx] = uint8(config >> (3 - idx) * 8);
109
}
110
111
/** Evangelion Control Address */
112
address solutionAddress = address(uint160((input & ADDRESS_MASK) >> 96));
113
_validateEvangelionControlProtocol(solutionAddress, difficulty); /**
114
115
116
██████████████████████████████████████████████
117
█░░░░░░█████████░░░░░░░░░░░░░░█░░░░░░░░░░░░░░█
118
█░░▄▀░░█████████░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀▄▀▄▀▄▀▄▀░░█
119
█░░▄▀░░█████████░░▄▀░░░░░░░░░░█░░▄▀░░░░░░░░░░█
120
█░░▄▀░░█████████░░▄▀░░█████████░░▄▀░░█████████
121
█░░▄▀░░█████████░░▄▀░░░░░░░░░░█░░▄▀░░█████████
122
█░░▄▀░░█████████░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀░░██░░░░░░█
123
█░░▄▀░░█████████░░▄▀░░░░░░░░░░█░░▄▀░░██░░▄▀░░█
124
█░░▄▀░░█████████░░▄▀░░█████████░░▄▀░░██░░▄▀░░█
125
█░░▄▀░░░░░░░░░░█░░▄▀░░█████████░░▄▀░░░░░░▄▀░░█
126
█░░▄▀▄▀▄▀▄▀▄▀░░█░░▄▀░░█████████░░▄▀▄▀▄▀▄▀▄▀░░█
127
█░░░░░░░░░░░░░░█░░░░░░█████████░░░░░░░░░░░░░░█
128
██████████████████████████████████████████████
129
Defeat the Elohim
130
131
You're cleared to establish Eva-link with NERV Command...
132
This is it pilot -- good luck and God speed! */
133
(uint256 s2EngineCheck, uint256 dnaSampled) = callNERVCommand(solutionAddress, configVals, difficulty);
134
135
136
// Post-op S2 Engine integrity check
137
_superSolenoidEngineCheck(s2EngineCheck, difficulty);
138
139
140
// Are ya winning, son?
141
worldSaved = dnaSampled == dnaVerification;
142
}
143
144
// Syncing with an Evangelion is a delicate process.
145
// Configuration settings are based on the pilot's DNA and temporal environment factors.
146
// All configuration settings must be valid quantum values -- 0x69 is sacred.
147
function generateEvaConfig(address _seed, uint8 difficulty) public view returns (uint256 actualSeed) {
148
uint256 adjustedBlock;
149
if (difficulty == DIFFICULTY_LEVEL_HARD) adjustedBlock = block.number >> 7;
150
if (difficulty == DIFFICULTY_LEVEL_INSANE) adjustedBlock = block.number >> 5;
151
if (difficulty == DIFFICULTY_LEVEL_IMPOSSIBLE) adjustedBlock = block.number >> 3;
152
if (difficulty == DIFFICULTY_LEVEL_CHAINLIGHT) adjustedBlock = block.number;
153
154
uint32 hash = uint32(bytes4(keccak256(abi.encodePacked(_seed, adjustedBlock))));
155
156
uint256 val;
157
uint256 shiftAmount;
158
for (uint256 idx; idx < 4; ++idx) {
159
shiftAmount = (3 - idx) * 8;
160
val = uint8(hash >> shiftAmount);
161
if (val <= 0x1 || !_isValidQuantumValue(bytes1(uint8(val)), difficulty)) {
162
val = 0x69;
163
}
164
actualSeed |= (val << shiftAmount);
165
}
166
}
167
168
function callNERVCommand(address solutionAddress, uint256[] memory configVals, uint8 difficulty)
169
public
170
view
171
returns (uint256 s2EngineCheck, uint256 dnaSampled)
172
{
173
/**
174
__ _._.,._.__
175
.o8888888888888888P'
176
.d88888888888888888K
177
,8 888888888888888888888boo._
178
:88b 888888888888888888888888888b.
179
`Y8b 88888888888888888888888888888b.
180
`Yb. d8888888888888888888888888888888b
181
`Yb.___.88888888888888888888888888888888888b
182
`Y888888888888888888888888888888CG88888P"'
183
`88888888888888888888888888888MM88P"'
184
"Y888K "Y8P""Y888888888888888888888888oo._""""
185
88888b 8 8888`Y88888888888888888888888oo.
186
8"Y8888b 8 8888 ,8888888888888888888888888o,
187
8 "Y8888b8 8888""Y8`Y8888888888888888888888b.
188
8 "Y8888 8888 Y `Y8888888888888888888888
189
8 "Y88 8888 .d `Y88888888888888888888b
190
.d8b. "8 .d8888b..d88P `Y88888888888888888888
191
`Y88888888888888888b.
192
"Y888P""Y8b. "Y888888888888888888888
193
888 888 Y888`Y888888888888888
194
888 d88P Y88b `Y8888888888888
195
888"Y88K" Y88b dPY8888888888P
196
888 Y88b Y88dP `Y88888888b
197
888 Y88b Y8P `Y8888888
198
.d888b. Y88b. Y `Y88888
199
`Y88K
200
`Y8*/
201
202
(bool success, bytes memory data) = address(NERV).staticcall(
203
abi.encode(
204
solutionAddress,
205
configVals[0],
206
configVals[1],
207
configVals[2],
208
configVals[3],
209
difficulty
210
)
211
);
212
require(success, "link interrupted");
213
uint256 dnaSampledFull;
214
(s2EngineCheck, dnaSampledFull) = abi.decode(data, (uint256, uint256));
215
dnaSampled = uint56(dnaSampledFull);
216
}
217
218
////////////////////////////////////////////////////////////////////////////////////////
219
// VALIDATIONS //
220
////////////////////////////////////////////////////////////////////////////////////////
221
222
function _validateSimulatorDifficulty(uint8 difficulty, address pilot) internal pure {
223
/** There are 4 levels of difficulty that pilots can choose when entering the simulator:
224
225
0x01 - HARD
226
0x02 - INSANE
227
0x03 - IMPOSSIBLE
228
0x18 - CHAINLIGHT
229
230
Pilot ranked #1 on the Curta leaderboard must select CHAINLIGHT
231
Pilots ranked #2-#10 on the Curta leaderboard must select at least level IMPOSSIBLE
232
Pilots ranked #11-#25 must select at least difficulty level INSANE
233
All other pilots must select at least difficulty level HARD
234
235
Warning: Choosing the CHAINLIGHT difficulty means engaging in a live battle with the
236
Elohim. The number one rank on the leaderboard is required to engage in this mode, but
237
anyone brave enough can also try. Evangelions lost in this mode CANNOT be revived.
238
239
Choose your difficulty by setting the lowest byte of the solution to the desired difficulty
240
level. Choosing a higher difficulty is guaranteed to bring you untold fame, new friends,
241
and increased chances of finding a girlfriend. */
242
243
bool valid;
244
if (_isLeadeboardTopDog(pilot)) {
245
valid = difficulty == DIFFICULTY_LEVEL_CHAINLIGHT;
246
} else if (_isLeaderboardTop10(pilot)) {
247
valid = _isDifficultyImpossibleOrHigher(difficulty);
248
} else if (_isLeaderboardTop25(pilot)) {
249
valid = _isDifficultyInsaneOrHigher(difficulty);
250
} else {
251
valid = difficulty == DIFFICULTY_LEVEL_HARD || _isDifficultyInsaneOrHigher(difficulty);
252
}
253
254
require(valid, "no plebs"); // you're like a pleb in a pillory in lieu of this exposé...
255
}
256
257
function _superSolenoidEngineCheck(uint256 s2EngineCheck, uint8 difficulty) internal pure {
258
uint solenoidEngineThreshold;
259
if (difficulty == DIFFICULTY_LEVEL_CHAINLIGHT) {
260
solenoidEngineThreshold = 3748;
261
} else if (difficulty == DIFFICULTY_LEVEL_IMPOSSIBLE) {
262
solenoidEngineThreshold = 4000;
263
} else if (difficulty == DIFFICULTY_LEVEL_INSANE) {
264
solenoidEngineThreshold = 4150;
265
} else if (difficulty == DIFFICULTY_LEVEL_HARD) {
266
solenoidEngineThreshold = 4340;
267
}
268
require(s2EngineCheck <= solenoidEngineThreshold, "s2 engine failure");
269
}
270
271
function _isValidCodeSize(address solution, uint8 difficulty) internal view returns (bool) {
272
uint256 maxCodeSize;
273
if (difficulty == DIFFICULTY_LEVEL_CHAINLIGHT) {
274
maxCodeSize = 189;
275
} else if (difficulty == DIFFICULTY_LEVEL_IMPOSSIBLE) {
276
maxCodeSize = 222;
277
} else if (difficulty == DIFFICULTY_LEVEL_INSANE) {
278
maxCodeSize = 300;
279
} else if (difficulty == DIFFICULTY_LEVEL_HARD) {
280
maxCodeSize = 466;
281
}
282
return solution.code.length <= maxCodeSize;
283
}
284
285
function _isValidQuantumValue(bytes1 opcd, uint8 difficulty) internal pure returns (bool) {
286
if (difficulty == DIFFICULTY_LEVEL_CHAINLIGHT) {
287
if (opcd == 0x18 || opcd == 0x42 || opcd == 0x44 ||
288
opcd == 0x46 || opcd == 0x48) return false;
289
}
290
if (_isDifficultyImpossibleOrHigher(difficulty)) {
291
if (opcd == 0x34 || opcd == 0x33 || opcd == 0x39 ||
292
opcd == 0x3f || opcd == 0x40) return false;
293
}
294
if (_isDifficultyInsaneOrHigher(difficulty)) {
295
if (opcd == 0xF1 || opcd == 0xF2 || opcd == 0xF4 ||
296
opcd == 0xFa || opcd == 0xFe) return false;
297
}
298
return !(opcd == 0xf5 || opcd == 0xff);
299
}
300
301
function _validateQuantamValues(address solution, uint8 difficulty) internal view {
302
bytes memory bts = solution.code;
303
for (uint256 idx; idx < bts.length; ++idx) {
304
if (!_isValidQuantumValue(bts[idx], difficulty)) revert QuantumOpcodeError(bts[idx]);
305
}
306
}
307
308
function _isValidAddress(address solution, uint8 difficulty) public pure returns (bool valid) {
309
if (difficulty == DIFFICULTY_LEVEL_HARD) {
310
uint256 topBit = uint160(solution) >> 159;
311
valid = topBit == 1;
312
}
313
if (difficulty == DIFFICULTY_LEVEL_INSANE) {
314
valid = bytes1(bytes20(solution)) == bytes1(uint8(0x69));
315
}
316
if (difficulty == DIFFICULTY_LEVEL_IMPOSSIBLE) {
317
valid = bytes2(bytes20(solution)) == bytes2(uint16(0x0420));
318
}
319
if (difficulty == DIFFICULTY_LEVEL_CHAINLIGHT) {
320
valid = bytes3(bytes20(solution)) == bytes3(uint24(0x181818));
321
}
322
}
323
324
function _validateEvangelionControlProtocol(address solution, uint8 difficulty) internal view {
325
/** You're not a rookie any more, pilot.
326
327
Runtime gas limits, bytecode size restraints, opcode restrictions, and vanity addresses are
328
just par for the course. Let's do this and get on the battle field. */
329
require(_isValidAddress(solution, difficulty), "mining failure");
330
require(_isValidCodeSize(solution, difficulty), "too long! twss");
331
_validateQuantamValues(solution, difficulty);
332
}
333
334
////////////////////////////////////////////////////////////////////////////////////////
335
// UTILITIES //
336
////////////////////////////////////////////////////////////////////////////////////////
337
338
function _isLeadeboardTopDog(address addr) internal pure returns (bool) {
339
return addr == LEADERBOARD_1_ADDRESS;
340
}
341
342
function _isLeaderboardTop10(address addr) internal pure returns (bool) {
343
return addr == LEADERBOARD_2_ADDRESS || addr == LEADERBOARD_3_ADDRESS ||
344
addr == LEADERBOARD_4_ADDRESS || addr == LEADERBOARD_5_ADDRESS ||
345
addr == LEADERBOARD_6_ADDRESS || addr == LEADERBOARD_7_ADDRESS ||
346
addr == LEADERBOARD_8_ADDRESS || addr == LEADERBOARD_9_ADDRESS ||
347
addr == LEADERBOARD_10_ADDRESS;
348
}
349
350
function _isLeaderboardTop25(address addr) internal pure returns (bool) {
351
return addr == LEADERBOARD_11_ADDRESS || addr == LEADERBOARD_12_ADDRESS ||
352
addr == LEADERBOARD_13_ADDRESS || addr == LEADERBOARD_14_ADDRESS ||
353
addr == LEADERBOARD_15_ADDRESS || addr == LEADERBOARD_16_ADDRESS ||
354
addr == LEADERBOARD_17_ADDRESS || addr == LEADERBOARD_18_ADDRESS ||
355
addr == LEADERBOARD_19_ADDRESS || addr == LEADERBOARD_20_ADDRESS ||
356
addr == LEADERBOARD_21_ADDRESS || addr == LEADERBOARD_22_ADDRESS ||
357
addr == LEADERBOARD_23_ADDRESS || addr == LEADERBOARD_24_ADDRESS ||
358
addr == LEADERBOARD_25_ADDRESS;
359
}
360
361
function _isDifficultyImpossibleOrHigher(uint8 difficulty) internal pure returns (bool) {
362
return difficulty == DIFFICULTY_LEVEL_IMPOSSIBLE ||
363
difficulty == DIFFICULTY_LEVEL_CHAINLIGHT;
364
}
365
366
function _isDifficultyInsaneOrHigher(uint8 difficulty) internal pure returns (bool) {
367
return difficulty == DIFFICULTY_LEVEL_INSANE ||
368
_isDifficultyImpossibleOrHigher(difficulty);
369
}
370
371
372
////////////////////////////////////////////////////////////////////////////////////////
373
// STATIC VALUES //
374
////////////////////////////////////////////////////////////////////////////////////////
375
376
uint256 constant ADDRESS_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000;
377
uint256 constant CONFIG_MASK = 0x0000000000000000000000000000000000000000FFFFFFFF0000000000000000;
378
uint256 constant ANSWER_MASK = 0x000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF00;
379
380
uint8 constant DIFFICULTY_LEVEL_HARD = 0x1;
381
uint8 constant DIFFICULTY_LEVEL_INSANE = 0x2;
382
uint8 constant DIFFICULTY_LEVEL_IMPOSSIBLE = 0x3;
383
uint8 constant DIFFICULTY_LEVEL_CHAINLIGHT = 0x18; // 퍼즐 난이도 18이라니, 대박! 화이팅!
384
385
address constant LEADERBOARD_1_ADDRESS = 0xB49bf876BE26435b6fae1Ef42C3c82c5867Fa149; // chainlight.io
386
address constant LEADERBOARD_2_ADDRESS = 0x6E82554d7C496baCcc8d0bCB104A50B772d22a1F; // minimooger.eth
387
address constant LEADERBOARD_3_ADDRESS = 0x4a69B81A2cBEb3581C61d5087484fBda2Ed39605; // jinu.eth
388
address constant LEADERBOARD_4_ADDRESS = 0x14869c6bF40BBc73e45821F7c28FD792151b3f9A; // igorline.eth
389
address constant LEADERBOARD_5_ADDRESS = 0x0Fc363b52E49074a395B075a6814Cb8F37E8F8BE; // p0pular.eth
390
address constant LEADERBOARD_6_ADDRESS = 0xBDfeB5439f5daecb78A17Ff846645A8bDBbF5725; // datadanne.eth
391
address constant LEADERBOARD_7_ADDRESS = 0x2de14DB256Db2597fe3c8Eed46eF5b20bA390823; // eoa.sina.eth
392
address constant LEADERBOARD_8_ADDRESS = 0xB95777719Ae59Ea47A99e744AfA59CdcF1c410a1; // 0xcacti.eth
393
address constant LEADERBOARD_9_ADDRESS = 0xd4057e08B9d484d70C5977784fC1f6D82d45ff67; // kalzak.eth
394
address constant LEADERBOARD_10_ADDRESS = 0x97735C60c5E3C2788b7EE570306775e687095D19; // plotchy.eth
395
address constant LEADERBOARD_11_ADDRESS = 0x4790c165A2c4B37527B56ac7772B792912C46329;
396
address constant LEADERBOARD_12_ADDRESS = 0x0DEdcE798692E8C668d67e430151106aBC9ABCe1; // ngndev.eth
397
address constant LEADERBOARD_13_ADDRESS = 0x433EA2df6D7c567B1Dd55e3FB99512222Cb23d95; // ragepit.eth
398
address constant LEADERBOARD_14_ADDRESS = 0x79d31bFcA5Fda7A4F15b36763d2e44C99D811a6C; // horsefacts.eth
399
address constant LEADERBOARD_15_ADDRESS = 0x0165f91FAF9EDeb9C5817c7a3c92110aa5329BeA; // pa-tate.eth
400
address constant LEADERBOARD_16_ADDRESS = 0x58593392d72A9D90b133e1C8ecEec581C354687f; // sampriti.eth
401
address constant LEADERBOARD_17_ADDRESS = 0x03433830468d771A921314D75b9A1DeA53C165d7; // karmafacts.eth
402
address constant LEADERBOARD_18_ADDRESS = 0x79635b386B9bd6636Cd701879C32E6dd181C853F; // vicnaum.eth
403
address constant LEADERBOARD_19_ADDRESS = 0x6b756b6905A07be65FD59b50e58dD4C965C32500;
404
address constant LEADERBOARD_20_ADDRESS = 0x9470Ab9c3aAc221A57e94F522659D4327C5EAdEd; // sileo.eth
405
address constant LEADERBOARD_21_ADDRESS = 0x5f71a197D303Cd700511323976067ECe43dE8AD0; // shung.crypto-frens.eth
406
address constant LEADERBOARD_22_ADDRESS = 0x5DFfD5527551888c2AC47f799c4Dc8e830dECeE7; // sina.eth
407
address constant LEADERBOARD_23_ADDRESS = 0xC6868e56b7BeCd885102fdaF33137F1712Bcf1d7; // 0xkitetsu.eth
408
address constant LEADERBOARD_24_ADDRESS = 0x7976B5A96Dc857309498E8Ab0d342117c7C9e6c5; // adamegyed.eth
409
address constant LEADERBOARD_25_ADDRESS = 0x286cD2FF7Ad1337BaA783C345080e5Af9bBa0b6e; // forager.eth
410
411
////////////////////////////////////////////////////////////////////////////////////////
412
// NERV COMMAND SECURITY CLEARANCE REQUIRED //
413
////////////////////////////////////////////////////////////////////////////////////////
414
415
function setNERV(address nerv_) external {
416
require(msg.sender == owner);
417
NERV = nerv_;
418
}
419
function properRug(address newImpl) external {
420
require(msg.sender == owner);
421
impl = newImpl;
422
}
423
}
424
425
// ================END-OF-FILE: Puzzle.sol====================================================================================
426
427
428
429
// ================BEGIN-FILE: NERVCommand.huff====================================================================================
430
/**
431
432
███╗░░██╗███████╗██████╗░██╗░░░██╗  ██╗░░██╗░██████╗░
433
████╗░██║██╔════╝██╔══██╗██║░░░██║  ██║░░██║██╔═══██╗
434
██╔██╗██║█████╗░░██████╔╝╚██╗░██╔╝  ███████║██║██╗██║
435
██║╚████║██╔══╝░░██╔══██╗░╚████╔╝░  ██╔══██║╚██████╔╝
436
██║░╚███║███████╗██║░░██║░░╚██╔╝░░  ██║░░██║░╚═██╔═╝░
437
╚═╝░░╚══╝╚══════╝╚═╝░░╚═╝░░░╚═╝░░░  ╚═╝░░╚═╝░░░╚═╝░░
438
God's in His heaven, all's right with the world
439
440
┌─┬────────────────────────────────────────────────────────────────────────────────────────┬─┐
441
│ ├────────────────────────────────────────────────────────────────────────────────────────┤ │
442
│ │ // S // S //================\\ S \\ S \ │ │
443
│ │ // S // S // \\ S \\ S \\ │ │
444
│ │ ┌────────────────────────────┐ ┌────────────────────────────┐ │ │
445
│ │ │DANANG TYPE-8 DEFENSE SCREEN│ ___ │TIME TO COLLAPSE : 223.229 │ │ │
446
│ │ └────────────────────────────┘ \ \ └────────────────────────────┘ │ │
447
│ │ // S // S // \ X \ \\ S \\ S \\ │ │
448
│ │ // S // S // \ X \_________ \\ S \\ S \\ │ │
449
│ │ // S // S // \ CELEBRUM/ \\ S \\ S \\ │ │
450
│ │ // S // S // /01 _______/ \\ S \\ S \\ │ │
451
│ │ \\ S \\ S \\ / M / // S // S // │ │
452
│ │ \\ S \\ S \\ / A / // S // S // │ │
453
│ │ \\ S \\ S \\ / G / // S // S // │ │
454
│ │ \\ S \\ S \\ /_I_/ // S // S // │ │
455
│ │ ┌────────────────────────────┐ ┌────────────────────────────┐ │ │
456
│ │ │PROTECT NO. 666 ON MAGI-01 │ │TIME SINCE/SCREEN RAISED 009│ │ │
457
│ │ └────────────────────────────┘ └────────────────────────────┘ │ │
458
│ │ \\ S \\ S \\ // S // S // │ │
459
│ │ \\ S \\ S \\================// S // S // │ │
460
│ ├────────────────────────────────────────────────────────────────────────────────────────┤ │
461
└─┴────────────────────────────────────────────────────────────────────────────────────────┴─
462
463
================================EVANGELION-ERROR-CODES==============================
464
XX XX
465
XX 0001 - Evangelion synchronization failed XX
466
XX 0002 - Wave 1 - Invalid Evangelion response XX
467
XX 0003 - Super Solenoid Engine failure XX
468
XX 0004 - AT Field Fragmentation XX
469
XX 0005 - Soul Sync Out of Bounds XX
470
XX 0006 - Zero-Time Disruption XX
471
XX 0007 - Alpha Z881 XX
472
XX 0008 - Elohim DNA mismatch XX
473
XX 0009 - Fracked Inner Core XX
474
XX 0010 - Soul Pattern Unknown XX
475
XX 0011 - Angelic Code Injection XX
476
XX 0012 - Instrumentation Query Malfunction XX
477
XX 0013 - Quantum Energy Flux XX
478
XX 0014 - LCL Anomaly Detected XX
479
XX 0015 - Soul Sync Cascade Failure XX
480
XX 0016 - Eva Unit Energy Flux XX
481
XX XX
482
===================================================================================
483
*/
484
485
#define function eva_SEVEN() nonpayable returns ()
486
#define function eva_EIGHT() nonpayable returns ()
487
#define function eva_NINE() nonpayable returns ()
488
#define function eva_TEN() nonpayable returns ()
489
#define constant DIFFICULTY_LEVEL_HARD = 0x1
490
#define constant DIFFICULTY_LEVEL_INSANE = 0x2
491
#define constant DIFFICULTY_LEVEL_IMPOSSIBLE = 0x3
492
#define constant LIVE_MODE_ACTIVATED = 0x18
493
#define constant CD_EVA_CONTROL_ADDRESS = 0x0
494
#define constant SIMULATOR_SETTING = 0xa0
495
#define constant MAX_GAS_FOR_EVA = 0x30d40
496
#define macro MAIN() = takes (0) returns (0) {
497
498
//╱╱╱╱ ╱╱ ╱╱ ╱╱╱ ╱╱╱╱ ╱╱╱╱╱╱╱ ╱╱╱╱╱╱╱ ╱╱ ╱╱╱╱╱
499
//╱╱╱ ╱ ╱╱ ╱╱╱ ╱ ╱ ╱ ╱╱╭╮╱╱/╱╱ ╱╱╱╭╮╱╱╱╱╱╭╮ ╱╱
500
//╱╱╱╱╱ ╱╱ ╱ ╱╱╱ ╱╱ ╱╱╱┃┃╱╱╱╱╱╱╱╱╭╯╰╮╱╱╱╱┃┃ ╱╱
501
//╱╭━━┳━━┳╮╭┳╮╭┳━━┳━╮╭━╯┃╭━━┳━━┳━╋╮╭╋━┳━━┫┃ ╱╱
502
//╱┃╭━┫╭╮┃╰╯┃╰╯┃╭╮┃╭╮┫╭╮┃┃╭━┫╭╮┃╭╮┫┃┃╭┫╭╮┃┃ ╱╱
503
//╱┃╰━┫╰╯┃┃┃┃┃┃┃╭╮┃┃┃┃╰╯┃┃╰━┫╰╯┃┃┃┃╰┫┃┃╰╯┃╰╮╱╱
504
// ╰━━┻━━┻┻┻┻┻┻┻╯╰┻╯╰┻━━╯╰━━┻━━┻╯╰┻━┻╯╰━━┻━╯
505
506
507
508
/** *************************** */
509
/** ** !!!START HERE!!! ** */
510
/** *************************** */
511
512
/** 5F Push Zero to Initiate Attack
513
|
514
\ | /
515
\*/
516
0x00
517
518
/** がんばって!*/
519
520
WAVE1()
521
522
/** ファイト!*/
523
524
WAVE2()
525
526
527
// | \\
528
529
530
// \\
531
532
/** WAVE's 1 and 2 are complete. The Elohim appears to be down...
533
.
534
..
535
...
536
....
537
..............................................................................................
538
==> HARD and INSANE mode skip this part and proceed directly to fin: <==
539
540
███████╗██╗ ██╗██╗██████╗
541
██╔════╝██║ ██╔╝██║██╔══██╗
542
███████╗█████╔╝ ██║██████╔╝
543
╚════██║██╔═██╗ ██║██╔═══╝
544
███████║██║ ██╗██║██║
545
╚══════╝╚═╝ ╚═╝╚═╝╚═╝
546
==> HARD and INSANE mode skip this part and proceed directly to fin: <==
547
..............................................................................................
548
*/
549
[SIMULATOR_SETTING] calldataload [DIFFICULTY_LEVEL_HARD] eq
550
[SIMULATOR_SETTING] calldataload [DIFFICULTY_LEVEL_INSANE] eq or fin jumpi/**
551
..............................................................................................
552
.....
553
....
554
...
555
..
556
.
557
558
NERV Commmand: Come in pilot! Sensors indicating the Elohim is still showing signs of life...
559
560
We need you to finish it off with two final attack waves. Go, go, go!
561
562
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ ATTACK_WAVE1() ATTACK_WAVE2()
563
564
/*************************/
565
/** LIVE MODE ONLY!! *//** /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/// */
566
/** */ [SIMULATOR_SETTING] calldataload [LIVE_MODE_ACTIVATED] // */
567
/** in simuluation mode */ eq iszero fin jumpi // */
568
/** skip this section *//** /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/// */
569
/** and proceed to final */
570
/** * ->->->->->->->->->->->->->->->->->-> * \ . | * . . . * | . / */
571
/** * ->->->->->->->->->->->->->->->->->-> */ THE_FIFTH_IMPACT() // *
572
/*********************** * ->->->->->->->->->->->->->->->->->-> * / ' | * . . . * | ' \ */
573
574
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
575
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
576
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
577
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
578
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
579
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\
580
___
581
|__ | |\ |
582
| | | \|
583
584
-/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
585
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
586
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
587
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
588
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
589
/** -/;.'/.`// \.*;'/+.`',.'-/';.&,;'.* \.;*-,.\ / ..,`*.&/';.&,;'.* \.;*-,.\ /;'.* \.;*-,.\ */
590
591
fin:
592
/** You made it through, pilot. Did you predict the correct DNA sequence? */
593
594
0x20 mstore 0x00 mstore 0x40 0x00
595
return
596
}
597
598
599
// ================================EVANGELION-OPERATIONAL-MANDATES=================+MAGI-01-ORIGINAL
600
601
#define macro ZERO_TIME_SOUL_SYNC(errorcode) = takes (1) returns (0) {
602
no_fail jumpi
603
<errorcode> 0x00 mstore 0x20 0x00 revert
604
no_fail:
605
}
606
607
#define macro ALPHA_Z8881() = takes (0) returns (0) {
608
returndatasize 0x20 eq all_good jumpi
609
0x7 0x00 mstore 0x20 0x00 revert
610
all_good:
611
}
612
613
#define macro ANALYZE_EVA_RESPONSE() = takes (1) returns (0) {
614
ZERO_TIME_SOUL_SYNC(0x01) ALPHA_Z8881()
615
}
616
617
618
// ================================EVANGELION-ATTACK-MANDATES=====================+MAGI-02-ORIGINAL
619
620
#define macro WAVE1() = takes (0) returns (0) {
621
/** INITIATE SYNCHRONIZED ATTACK WAVE 0x1 */ ATTACK_WAVE1() /**
622
623
\\
624
- \\ . ^
625
\ . ^ ^
626
_ ===7===== / *)
627
========= \ *)>> ()
628
- / \\ |
629
// \\ // ***\ \ ..
630
\\ // \ =======// * * \\====== `
631
\\ ===8===== / \> ///===\ //\\____// ===\\\ /
632
\ - ========= \ /> ||| \| |/ \\\ ' "
633
=10====== / ()_ / ||| | O---O | \\\___....
634
========= \ () \\ // ||| | - | \\\///oo///=-=-=- .
635
/ \\ // X|X | | XX|X===////'' o `'
636
// \ ()||\ | O---O | ^^^^ _____***
637
// =9======= / .) | / \ // /\ \\ | o o o** .
638
========= \ .) \\ \ \ \\ ____ .| o o o |'
639
/ o ___ \\ \ \ || |o o| /|==| o o o |.
640
. - // _____| O | || || \ || |o o| /=| | o o o |
641
// |XXxO| O | /_____\ /_____\ | |/ | | o|| o |:
642
*/
643
}
644
645
#define macro WAVE2() = takes (0) returns (0) {
646
/** This is it pilot! We need to finish this angel off and take a second DNA sample.
647
648
The Elohim angels are reportedly capable of some unbelievable feats when they are
649
close to death. It's even rumored that they can alter their own DNA.
650
651
Watch your power levels and don't let your guard down! Good luck! */
652
653
ATTACK_WAVE2_FINISH_HIM() /** Wave 0x2 - Let's end this now pilot! Aerial attack formation!
654
655
656
. . \ \ ||
657
9| | /
658
^ \\ || // o *
659
\\ || //
660
^ \ z \ || / || . /
661
\/\/ 10
662
^ ^ ^^^^ \\ || //
663
^ ^ ^ \ 00 \\ || // ,
664
^ ^ | \__/ \ || /
665
^ . \/\/
666
|| (XXX) "
667
. 8| | \|/
668
\\ || //
669
\\ || // || / '
670
\ || / 7|
671
\/\/ \\ || // .
672
(**) \\ || //
673
^ | \ || /
674
. \/\/ .
675
()()
676
\|
677
_______
678
(x )==O
679
\ | )_ () ___....
680
______ \\\ | \'\///oo///=-=-=-*>*>*>
681
O==(x ) \\ // *** \ ///XX|X===////''
682
, \\======// o o \\====== //
683
_______ =\ //\\__O_// ===\\\ .
684
O==(x ) \| |/
685
. | O---O | * .
686
. / | - XxX| - "
687
** | x | \' * '
688
_________ . * | O---O |
689
| o o o o | ___^^^^_ // /\ \\ * * * .
690
____ | o o o o |___ | O O | \\ \ \ \\
691
|o o| /|==| o o o o | - |____ | O O | \\ \ \ || . * ,
692
|o o| /=| | o o o o | - | == || O O | || || \ ||
693
| |/ | | o ||| o | | = || |^|^| |\ /_____\ /_____\ * ** * * ** */
694
}
695
696
#define macro THE_FIFTH_IMPACT() = takes (1) returns (1) {
697
/** Good fighting so far, pilot! Congrats on taking out the scout Elohim.
698
But now it's too late. An advance batallion of 100 Elohim has just landed!
699
We don't have the genetic weapon ready yet so you'll have to engage these enemies,
700
there is no other alternative. Can you defeat all of these foes? */
701
702
//(f*zzz
703
//
704
//
705
//*************************\\
706
/** \ / **/
707
/** 0 0 **/
708
ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2() ATTACK_WAVE1()
709
ATTACK_WAVE1() ATTACK_WAVE2()/** \\________________// */ ATTACK_WAVE2() ATTACK_WAVE1()
710
ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1()
711
ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2()
712
ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2()
713
ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1()
714
ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2()
715
ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2() ATTACK_WAVE1()
716
ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2() ATTACK_WAVE1()
717
ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2()
718
ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2()
719
ATTACK_WAVE2() ATTACK_WAVE1()
720
ATTACK_WAVE2() ATTACK_WAVE1()
721
ATTACK_WAVE1() ATTACK_WAVE2()
722
ATTACK_WAVE1() ATTACK_WAVE1()
723
ATTACK_WAVE2() ATTACK_WAVE1()
724
ATTACK_WAVE2() ATTACK_WAVE2()
725
ATTACK_WAVE1() ATTACK_WAVE1()
726
ATTACK_WAVE2() ATTACK_WAVE2()
727
ATTACK_WAVE1() ATTACK_WAVE2()
728
ATTACK_WAVE1() ATTACK_WAVE1()
729
ATTACK_WAVE2() ATTACK_WAVE1()
730
ATTACK_WAVE1() ATTACK_WAVE2()
731
ATTACK_WAVE1() ATTACK_WAVE2()
732
ATTACK_WAVE2() ATTACK_WAVE1()
733
ATTACK_WAVE1() ATTACK_WAVE2()
734
ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE1()
735
ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE1()
736
ATTACK_WAVE2() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2()
737
/** ** * */ATTACK_WAVE1() ATTACK_WAVE1() ATTACK_WAVE2() ATTACK_WAVE2() /** * * * *** * * **** ** ** *** *** * ** ** *** ** */
738
/** * * *** * * ** ** *** ***** * * *** ****** * * ** * * * ****** **** * * ** ** ******* **** ** *** *** *** ** * * ** * ***** ** *** * * */
739
/* * * * *** * * **** * * *** ****** * * ** * * * ****** **** * * ** ** ******* **** **** ** * ** ** *** *** *** ** * * ** * * ** *** * * *** */
740
/** **b*zzz ** * * *** * * * ** *** ***** * * ** ** *** *** *** ** * * ** * ************* * *** * ** ** * ***** ** *** * * ** ** ** ** *** * */
741
}
742
743
744
745
// // ================================EVANGELION-ATTACK-UTILITIES=================+MAGI-03-ORIGINAL
746
747
#define fn ATTACK_WAVE1() = takes (1) returns (1) {
748
0x07
749
EVA_SEVEN()
750
EVA_EIGHT()
751
EVA_NINE()
752
EVA_TEN()
753
pop
754
}
755
756
#define macro EVA_SEVEN() = takes (2) returns (2) {
757
__FUNC_SIG(eva_SEVEN) 0x00 mstore CONFIRM_EVA_CONTRACT()
758
}
759
760
#define macro EVA_EIGHT() = takes (2) returns (2) {
761
__FUNC_SIG(eva_EIGHT) 0x00 mstore CONFIRM_EVA_CONTRACT()
762
}
763
764
#define macro EVA_NINE() = takes (2) returns (2) {
765
__FUNC_SIG(eva_NINE) 0x00 mstore CONFIRM_EVA_CONTRACT()
766
}
767
768
#define macro EVA_TEN() = takes (2) returns (1) {
769
__FUNC_SIG(eva_TEN) 0x00 mstore CONFIRM_EVA_CONTRACT()
770
}
771
772
#define macro ATTACK_WAVE2() = takes (1) returns (2) {
773
__FUNC_SIG(eva_SEVEN) 0x00 mstore CALL_EVA_CONTRACT()
774
__FUNC_SIG(eva_EIGHT) 0x00 mstore CALL_EVA_CONTRACT()
775
__FUNC_SIG(eva_NINE) 0x00 mstore CALL_EVA_CONTRACT()
776
__FUNC_SIG(eva_TEN) 0x00 mstore CALL_EVA_CONTRACT()
777
778
// Angel neural resequencing
779
add add add
780
0x07 0x20 calldataload exp
781
0x08 0x40 calldataload exp
782
0x09 0x60 calldataload exp
783
0x10 0x80 calldataload exp
784
add add add
785
786
dup1 swap2 eq ZERO_TIME_SOUL_SYNC(0x18)
787
swap1 add
788
}
789
790
// Same as ATTACK_WAVE2 but this one includes a S2 Engine gas check
791
#define macro ATTACK_WAVE2_FINISH_HIM() = takes (1) returns (2) {
792
793
gas
794
__FUNC_SIG(eva_SEVEN) 0x00 mstore CALL_EVA_CONTRACT()
795
__FUNC_SIG(eva_EIGHT) 0x00 mstore CALL_EVA_CONTRACT() add
796
__FUNC_SIG(eva_NINE) 0x00 mstore CALL_EVA_CONTRACT() add
797
__FUNC_SIG(eva_TEN) 0x00 mstore CALL_EVA_CONTRACT() add
798
gas
799
800
// Angel neural resequencing
801
0x07 0x20 calldataload exp
802
0x08 0x40 calldataload exp add
803
0x09 0x60 calldataload exp add
804
0x10 0x80 calldataload exp add
805
806
dup1 swap3 eq ZERO_TIME_SOUL_SYNC(0x8)
807
808
// Super Solenoid power level evaluation
809
swap3 add swap2 swap1 sub swap1
810
}
811
812
#define macro CALL_EVA_CONTRACT() = takes (0) returns (1) {
813
gas [MAX_GAS_FOR_EVA] lt
814
ZERO_TIME_SOUL_SYNC(0x03)
815
816
0x00 0x20 0x04 0x1c [CD_EVA_CONTROL_ADDRESS] calldataload [MAX_GAS_FOR_EVA] staticcall
817
ANALYZE_EVA_RESPONSE()
818
returndatasize 0x0 0x20 returndatacopy 0x20 mload
819
}
820
821
#define fn CONFIRM_EVA_CONTRACT() = takes (2) returns (2) {
822
swap1
823
CALL_EVA_CONTRACT()
824
825
0x06 dup4 sub 0x20 mul calldataload dup4 swap1 exp dup2 eq
826
ZERO_TIME_SOUL_SYNC(0x02)
827
add swap1 0x01 add
828
}
First Blood
jinu.eth
02:44:12
15
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