Skip to content

Instantly share code, notes, and snippets.

@karmacoma-eth
Created April 15, 2023 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karmacoma-eth/f37594403e8c7d9eab81b83366b429f1 to your computer and use it in GitHub Desktop.
Save karmacoma-eth/f37594403e8c7d9eab81b83366b429f1 to your computer and use it in GitHub Desktop.
curta puzzle 7 solution in huff
#define macro MAIN() = takes(0) returns(0) {
// sol.stop
__VERBATIM(0x01)
// sol.ctxSetting
__VERBATIM(0x00)
// store origin at memory location 0
origin push0 mstore
// keccak[12:12+20]
0x14 0xc sha3
// store at memory location 0
push0 mstore
// return it
// 💣 it would better to use msize here, but Evm.sol doesn't support it 💀
0x20 push0 return
}
// `huffc --bytecode kekorigin.huff` gives this deployment bytecode
// 60108060093d393df30100325f526014600c205f5260205ff3
// make it a uint256 with the executable code first:
// 60108060093d393df30100325f526014600c205f5260205ff300000000000000
// 'huffboi' in hex:
// 68756666626f69
// the whole thing:
// 60108060093d393df30100325f526014600c205f5260205ff368756666626f69
// actually the 3d = returndatasize in the deployment code generated by huffc won't work, make them push0s
// 60108060095f395ff30100325f526014600c205f5260205ff368756666626f69
// 🏆
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment