From f31d22a038a5a915a1013ceb654d2eaa69ecaeb0 Mon Sep 17 00:00:00 2001 From: "shafu.eth" Date: Fri, 1 Mar 2024 14:41:22 +0100 Subject: [PATCH] env opcodes desc --- _build/.doctrees/environment.pickle | Bin 106101 -> 106931 bytes _build/html/searchindex.js | 2 +- .../05_1_state-checkpoint.ipynb | 258 ++++++++ content/05_1_state.ipynb | 34 + .../12_environment-checkpoint.ipynb | 615 ++++++++++++++++++ content/opcodes/12_environment.ipynb | 145 ++++- 6 files changed, 1049 insertions(+), 5 deletions(-) create mode 100644 content/.ipynb_checkpoints/05_1_state-checkpoint.ipynb create mode 100644 content/opcodes/.ipynb_checkpoints/12_environment-checkpoint.ipynb diff --git a/_build/.doctrees/environment.pickle b/_build/.doctrees/environment.pickle index eab002f4b0fc4b6987f9da0100c3b36fceb8cddf..d00e58755011e7f59516916102049e9a5d33b407 100644 GIT binary patch delta 13326 zcmc&ad3;kQq%%vUo23z0;Q#ZY$BAj4Q(!MQ<8>7gb>6+FtRw2 zgCZ_0iVK^SR&`uPb0iYr?Y1yS(LoO^GQLhSdw@4er9{o|gQGjrz5oHH|b z?xerg1y&yj^j{e8Sd$(8Cvy^87MjW{4ds=cOcjNuB7?={Y@y8<%PY+$(C0?Lw9r6s zj%o{C^K@X!3!#yp2w}m{B`*#Nb9FqSDGO@l4A)k6?w+5XZ>iK*8gRMbcr+{!((@wV zWNt`=&dt^}zsyi(GS7AK4oz8`X3oGdLox^F3~@Q*LEj=C4&m0LS_U<7IpbhoXdK+1 z+d3@Fy|_!hKEGHGo%343fZUKM@6Fw|w1$?t*4?H=UaoUv*KQvx zZ_}`v%S^M4STJ}Z&T$BZmcS$LVm%G)jjvMT&-cdnmql3yw{E87TzU4=f;*rjg+^z zv3D0fE^qd?sn+k77XB!|q7iqG*%~Ro=*Ap#$I9E?*r7}7%d4-j|Qd zwQg+rsKN3kH+JNWv+`CAtBaief&8++UyO42brXJ>D!=L`uC>gEuH*U+rXyeBN_FbU z^^Ap`6z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mUL>+@mFovUHNb~RS{4KLId zYp04kwSj2kH^DqjU!WI3!3k6wr_m^FsmWYqD6Jhf>MW`rEfR~0Phofh%6HQqv8ra* zQ!$<%gC@EQiwHQd;`X8|k$MN)entxSf@T6D75(8o8IWf*m`q096!@j78UM9&Fp7^Z zC-IGrf@+xq@OgPT$@cAmJwbM%oFqul*w{+u4EqZpAx5qqp7#cLW0e%>;avyaP#spQ zmt2VtGcU8$F{ClYz`3n!8Pm-H0b--6aexXRFz}If|@AJu6 zA98@F+el2fxxHuddAl$C7PV9lFVhi&?rmNo-H4vcD{Q1&U;HwM!2@Hkil;$Pi=UCU zPibSO!N?7|J-27vWy>Dg9JqoU8UmG#LfX?tB1l+uf3}F4!1C$T%N7M z9IZUi^V8IZCW8qQcPI&wXRZT^1$XTJs?kpm?2_FO3?^9I!c6J=y)v15ZJRD$*za_0 z6xesLkG8-9w<lT>Ha|hF*g>*-O zxm$gDzPEWxJs2?A<)ir9Ww$8fdVH-;=KUM@d#CMc&@C{Jw_R6wJcaMX|_H zrDIXBx-|EWj@rWxB6_lF`bYWMJuwDN+VG7hO%(dvz3QWyK%gN>a8gxC(pt?ip zlz8_W6~z*?@VA!HryH^fGq7%93Y&bXz}y+vtK!5<9u1*j0@n?S#oTFY@B#(q_K1i2 zzl>}U1{1(;V9cE!+&3vG_rA$aDd^syNti#DQ3gR>>vrv&SYD&R+<5W*HlC9knhZS1 GI{z;lp1-yL diff --git a/_build/html/searchindex.js b/_build/html/searchindex.js index c68ccb9..3f3fd67 100644 --- a/_build/html/searchindex.js +++ b/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({"docnames": ["README", "content/02_a_gas", "content/02_stack", "content/03_memory", "content/04_storage", "content/05_1_state", "content/05_opcodes", "content/24_evm", "content/25_bytecode", "content/26_run", "content/99_conclusion", "content/intro", "content/opcodes", "content/opcodes/06_stop", "content/opcodes/07_math", "content/opcodes/08_comparisions", "content/opcodes/09_logic", "content/opcodes/10_bit", "content/opcodes/11_misc", "content/opcodes/12_environment", "content/opcodes/13_pop", "content/opcodes/14_memory", "content/opcodes/15_storage", "content/opcodes/16_jump", "content/opcodes/17_push", "content/opcodes/18_dup", "content/opcodes/19_swap", "content/opcodes/20_log", "content/opcodes/21_contract"], "filenames": ["README.md", "content/02_a_gas.ipynb", "content/02_stack.ipynb", "content/03_memory.ipynb", "content/04_storage.ipynb", "content/05_1_state.ipynb", "content/05_opcodes.ipynb", "content/24_evm.ipynb", "content/25_bytecode.ipynb", "content/26_run.ipynb", "content/99_conclusion.ipynb", "content/intro.ipynb", "content/opcodes.ipynb", "content/opcodes/06_stop.ipynb", "content/opcodes/07_math.ipynb", "content/opcodes/08_comparisions.ipynb", "content/opcodes/09_logic.ipynb", "content/opcodes/10_bit.ipynb", "content/opcodes/11_misc.ipynb", "content/opcodes/12_environment.ipynb", "content/opcodes/13_pop.ipynb", "content/opcodes/14_memory.ipynb", "content/opcodes/15_storage.ipynb", "content/opcodes/16_jump.ipynb", "content/opcodes/17_push.ipynb", "content/opcodes/18_dup.ipynb", "content/opcodes/19_swap.ipynb", "content/opcodes/20_log.ipynb", "content/opcodes/21_contract.ipynb"], "titles": ["Building the EVM from Scratch", "Gas", "Stack", "Memory", "Storage", "EVM State", "Opcodes", "EVM", "Bytecode", "<no title>", "Resources", "Introduction", "Opcodes", "Stop", "Math", "Comparisons", "Logic", "Bit", "Misc", "Environment", "<no title>", "<no title>", "<no title>", "Jump", "<no title>", "<no title>", "<no title>", "<no title>", "<no title>"], "terms": {"we": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 18, 19, 23], "ar": [0, 1, 2, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 21], "go": [0, 5, 7, 11, 14], "ethereum": [0, 5, 18, 19], "virtual": [0, 11], "machin": [0, 5], "everi": [0, 2, 4, 6, 11, 12, 18], "major": 0, "topic": [0, 27], "cover": 0, "seper": [0, 19], "jupyt": 0, "notebook": [0, 6, 11, 12], "In": [0, 6, 8, 11, 12, 14], "end": [0, 11, 14], "combin": [0, 3, 11], "all": [0, 4, 5, 6, 11, 12, 13, 14], "block": [0, 3, 11], "creat": [0, 2, 3, 6, 11, 12, 18], "you": [0, 1, 2, 8, 10, 11, 14, 16, 19], "can": [0, 2, 3, 4, 5, 6, 8, 11, 12, 18, 19, 23], "view": 0, "directli": [0, 2, 11, 14, 18], "github": [0, 11], "download": 0, "repositori": 0, "execut": [0, 1, 3, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 17, 18, 23], "plai": 0, "around": 0, "local": 0, "A": [0, 2, 3, 4, 5, 6, 11, 12, 18, 21], "come": [0, 11], "soon": 0, "And": [0, 5], "upload": 0, "my": 0, "shafu": 0, "page": 0, "youtub": 0, "veri": [1, 2, 6, 11, 12, 13, 15, 16, 18], "import": [1, 11, 14, 18, 21], "concept": [1, 11, 16, 17], "It": [1, 2, 3, 4, 5, 7, 8, 11, 14, 18], "measur": 1, "amount": [1, 4, 7], "comput": [1, 4, 11], "work": [1, 2, 11, 14], "That": [1, 6, 11, 12], "could": [1, 8, 11, 18], "store": [1, 3, 4, 5, 19, 21, 22], "valu": [1, 2, 3, 4, 7, 14, 15, 17, 18, 19, 21, 22, 24, 25, 27], "storag": [1, 7, 11, 22], "expand": [1, 3], "size": [1, 3, 18, 27, 28], "memori": [1, 7, 11, 18, 19, 21, 27, 28], "an": [1, 2, 3, 4, 5, 6, 11, 12, 14, 18, 21, 23], "arithmet": [1, 6, 12, 14, 15], "oper": [1, 5, 6, 11, 12, 14, 16, 17, 18], "need": [1, 3, 5, 11, 14], "becaus": [1, 6, 11, 12], "ressourc": 1, "do": [1, 10, 11, 18, 22], "limit": 1, "so": [1, 11, 18], "order": 1, "avoid": 1, "ddo": 1, "attack": 1, "exampl": 1, "user": [1, 11], "spend": 1, "some": [1, 3, 6, 11, 12, 14], "run": [1, 7, 9, 11, 15, 17, 23], "hi": 1, "program": [1, 8, 11, 14, 18, 19, 23], "ha": [1, 2, 6, 11, 12, 18, 19], "paid": 1, "eth": 1, "If": [1, 4, 5, 10, 11], "out": [1, 7], "while": [1, 7], "your": [1, 4, 11], "bytecod": [1, 5, 7, 9, 18], "stop": [1, 5, 6, 7, 11, 12], "The": [2, 3, 4, 5, 7, 8, 11, 14, 18], "simpl": [2, 3, 11, 13], "data": [2, 5, 27], "structur": [2, 6, 12], "list": [2, 3, 8, 11], "one": [2, 5, 6, 7, 8, 9, 12, 14, 15, 17, 18, 21, 23], "restrction": 2, "onli": [2, 11, 18, 19, 23], "interact": [2, 11], "top": 2, "push": [2, 7, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25], "new": [2, 11], "pop": [2, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27, 28], "alreadi": [2, 5, 11], "exist": 2, "from": [2, 3, 4, 7, 11, 14, 17], "plate": 2, "good": [2, 11], "metaphor": 2, "add": [2, 3, 6, 7, 11, 12, 14], "remov": 2, "exact": 2, "same": [2, 16, 17, 18], "wai": [2, 3, 18], "evm": [2, 6, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "maximum": 2, "capac": 2, "1024": 2, "item": 2, "max": 2, "256": [2, 14, 17, 18, 19], "bit": [2, 3, 7, 9, 15, 18, 23], "32": [2, 3, 4, 17, 18, 19, 21], "byte": [2, 3, 4, 6, 12, 14, 19, 21], "maximum_stack_s": 2, "also": [2, 3, 11, 14, 18], "throw": [2, 4, 14], "except": [2, 4, 7, 9, 14, 15, 17, 19, 23], "try": [2, 14], "empti": [2, 3], "class": [2, 3, 4, 5, 7, 27], "def": [2, 3, 4, 5, 6, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "__init__": [2, 3, 4, 5, 7, 27], "self": [2, 3, 4, 5, 7, 9, 15, 17, 23, 27], "__str__": [2, 27], "return": [2, 3, 4, 5, 6, 7, 9, 12, 14, 15, 17, 23, 27], "n": [2, 7, 14, 20, 24, 25, 26], "join": [2, 24], "map": [2, 4, 24], "str": [2, 18, 24], "1": [2, 3, 4, 6, 7, 9, 12, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28], "len": [2, 3, 7, 19], "rais": [2, 7, 9, 15, 17, 19, 23], "overflow": 2, "append": [2, 3, 4, 19, 24], "0": [2, 3, 4, 5, 7, 9, 14, 15, 17, 19, 22, 23, 26, 27, 28], "underflow": 2, "del": 2, "3": [2, 3, 7, 9, 14, 15, 16, 17, 19, 23, 24, 25, 26, 27], "2": [2, 3, 7, 9, 14, 17, 19, 20, 23, 27], "4": [2, 3, 7, 27], "print": [2, 7, 9], "typeerror": [2, 7, 9, 15, 17, 23], "traceback": [2, 7, 9, 15, 17, 23], "most": [2, 5, 6, 7, 9, 11, 12, 14, 15, 17, 18, 23], "recent": [2, 7, 9, 15, 17, 23], "call": [2, 6, 7, 8, 9, 10, 11, 12, 15, 17, 18, 23], "last": [2, 7, 9, 15, 17, 19, 23], "var": [2, 7, 9, 15, 17, 23], "folder": [2, 7, 9, 15, 17, 23], "08": [2, 7, 9, 15, 17, 23], "q0syv9y576b_rnls32m9d3nr0000gn": [2, 7, 9, 15, 17, 23], "t": [2, 7, 9, 11, 15, 17, 23], "ipykernel_5296": 2, "1192403925": [2, 7], "py": [2, 7, 9, 10, 15, 17, 23], "cell": [2, 3, 7, 9, 15, 17, 23], "line": [2, 7, 9, 15, 17, 23], "miss": [2, 7], "requir": [2, 7], "posit": [2, 7, 17], "argument": [2, 7], "now": [2, 4, 7, 8, 16], "left": 2, "each": [3, 6, 12], "access": [3, 4, 10, 18, 19, 27, 28], "individu": 3, "similar": [3, 15], "ram": 3, "start": [3, 11], "being": 3, "complet": [3, 11], "volatil": [3, 4], "which": [3, 5, 7, 11], "mean": [3, 11], "after": [3, 5, 8, 11], "reset": [3, 7], "hold": 3, "8": [3, 7, 9, 14, 15, 17, 23, 27], "number": [3, 4, 6, 11, 12, 14], "between": 3, "255": 3, "repres": [3, 4, 6, 12, 14], "index": [3, 7], "offset": [3, 18, 19, 21, 27, 28], "would": [3, 8, 11, 14, 18], "get": [3, 17, 26], "5": [3, 7, 14], "7": [3, 14], "simplememori": 3, "load": [3, 4, 21, 22], "consum": [3, 5, 14], "ga": [3, 4, 7, 9, 10, 11, 14, 18], "non": [3, 4], "linearli": 3, "make": [3, 5, 6, 8, 11, 12, 23, 25], "more": [3, 4, 8, 14], "costli": 3, "larger": [3, 6, 12], "space": 3, "let": [3, 14, 17, 21], "expans": [3, 27], "calcul": [3, 14, 18], "memory_expansion_cost": [3, 18, 19, 27], "expansion_s": 3, "initi": [3, 4], "zero": 3, "0x00": [3, 4, 11, 19], "_": [3, 24], "rang": [3, 24], "extend": 3, "simplifi": [3, 11], "super": [3, 4], "0x01": [3, 8, 11], "0x02": [3, 11], "0x03": [3, 11], "0x04": [3, 11], "alwai": [3, 19], "thi": [3, 4, 5, 6, 8, 11, 12, 14, 16, 18, 19], "actual": [3, 8, 14], "how": [3, 4, 5, 11, 14], "cost": [3, 4, 14, 27], "calc_memory_expansion_ga": 3, "memory_byte_s": 3, "memory_size_word": 3, "31": [3, 14, 17, 18, 19], "memory_cost": 3, "512": 3, "round": 3, "kei": [4, 22], "practic": [4, 18], "purpos": 4, "infinit": 4, "up": [4, 8, 9, 11], "like": [4, 6, 8, 10, 11, 12, 14, 17], "ssd": 4, "sourc": [4, 18], "http": 4, "doc": 4, "alchemi": 4, "com": 4, "smart": [4, 11], "contract": [4, 11], "layout": 4, "dictionari": 4, "keyvalu": 4, "differ": [4, 6, 12, 16], "whether": [4, 11], "slot": 4, "said": [4, 11], "wa": [4, 18], "befor": [4, 11], "otherwis": 4, "than": [4, 6, 12], "implement": [4, 11, 14, 18], "logic": 4, "keep": [4, 5, 11], "track": [4, 5], "cach": 4, "when": [4, 5], "save": [4, 5, 21], "its": [4, 11, 18, 19], "true": [4, 5, 7, 13, 28], "els": [4, 9, 14, 15, 17, 19, 22, 23], "fals": [4, 5, 7], "420": 4, "notic": 4, "first": [4, 11, 13, 14], "time": [4, 11, 18], "retriev": 4, "someth": [4, 11], "read": 4, "random": [4, 18], "set": [4, 9, 13, 26], "ani": [4, 11, 18], "42069": 4, "valid": [5, 8, 11], "manipul": [5, 6, 12, 14], "specif": 5, "opcod": [5, 7, 8, 10, 11, 13, 14, 15, 19, 21, 23], "point": 5, "next": [5, 6, 7, 8], "them": [5, 6, 8, 11, 12, 14, 15, 18], "part": [5, 11], "area": 5, "where": [5, 11], "current": [5, 6, 11, 12, 18], "chang": [5, 11, 18], "dure": [5, 9, 15, 17, 23], "immut": 5, "much": 5, "have": [5, 6, 8, 11, 12, 18], "down": 5, "ether": 5, "wei": 5, "Is": 5, "input": [5, 11, 18], "our": [5, 11, 13], "two": [5, 21], "stop_flag": [5, 7, 13, 28], "revert_flag": [5, 7, 28], "There": [5, 6, 11, 12, 21], "sever": 5, "emit": 5, "result": [5, 7, 8, 9, 14, 15, 17, 23], "here": [5, 6, 8, 11, 12, 14], "insturct": [6, 12], "categori": [6, 12], "other": [6, 11, 12, 14], "deal": [6, 12], "stack": [6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "follow": [6, 12, 18], "thing": [6, 10, 11, 12], "common": [6, 12], "thei": [6, 10, 11, 12, 18], "why": [6, 11, 12], "function": [6, 11, 12, 14], "take": [6, 9, 11, 12], "instanc": [6, 12], "paramet": [6, 12], "uniqu": [6, 12], "identifi": [6, 11, 12], "convini": [6, 12], "denot": [6, 12], "hexadecim": [6, 11, 12], "To": [6, 12], "easier": [6, 12], "us": [6, 8, 9, 11, 12, 14, 15, 17, 18, 21, 23], "give": [6, 12, 19], "short": [6, 12], "descript": [6, 11, 12], "name": [6, 9, 11, 12, 15, 17, 23], "found": [6, 9, 12, 15, 17, 23], "0x0": [6, 12], "0x1": [6, 12], "mul": [6, 11, 12, 14], "0x2": [6, 12], "sub": [6, 11, 12, 14], "0x3": [6, 12], "div": [6, 11, 12, 14], "0x4": [6, 12], "sdiv": [6, 12, 14], "0x5": [6, 12], "mod": [6, 12, 14], "0x6": [6, 12], "smod": [6, 12, 14], "0x7": [6, 12], "addmod": [6, 12, 14], "0x8": [6, 12], "mulmod": [6, 12, 14], "0x9": [6, 12], "exp": [6, 12, 14], "0xa": [6, 12], "signextend": [6, 12, 14], "0xb": [6, 12], "lt": [6, 12, 15], "0x10": [6, 12], "gt": [6, 12, 15], "0x11": [6, 12], "slt": [6, 12, 15], "0x12": [6, 12], "sgt": [6, 12, 15], "0x13": [6, 12], "eq": [6, 12, 15], "0x14": [6, 12], "iszero": [6, 12, 15], "0x15": [6, 12], "AND": [6, 12], "0x16": [6, 12], "OR": [6, 12], "0x17": [6, 12], "xor": [6, 12], "0x18": [6, 12], "NOT": [6, 11, 12], "0x19": [6, 12], "0x1a": [6, 12], "shl": [6, 12, 17], "0x1b": [6, 12], "shr": [6, 12, 17], "0x1c": [6, 12], "sar": [6, 12, 17], "0x1d": [6, 12], "sha3": [6, 12, 18], "0x20": [6, 12], "address": [6, 12], "0x30": [6, 12], "balanc": [6, 12], "0x31": [6, 12], "origin": [6, 12], "0x32": [6, 12], "caller": [6, 7, 9, 12, 15, 17, 23], "0x33": [6, 12], "callvalu": [6, 12], "0x34": [6, 12], "calldataload": [6, 12], "0x35": [6, 12], "calldatas": [6, 12], "0x36": [6, 12], "calldatacopi": [6, 12], "0x37": [6, 12], "codes": [6, 12], "0x38": [6, 12], "codecopi": [6, 12], "0x39": [6, 12], "gaspric": [6, 12, 19], "0x3a": [6, 12], "extcodes": [6, 10, 12, 19], "0x3b": [6, 12], "extcodecopi": [6, 12, 19], "0x3c": [6, 12], "returndatas": [6, 12, 19], "0x3d": [6, 12], "returndatacopi": [6, 12, 19], "0x3e": [6, 12], "extcodehash": [6, 12, 19], "0x3f": [6, 12], "blockhash": [6, 12, 19], "0x40": [6, 12], "coinbas": [6, 12], "0x41": [6, 12], "timestamp": [6, 12], "0x42": [6, 8, 12], "0x43": [6, 12], "difficulti": [6, 12], "0x44": [6, 12], "gaslimit": [6, 12], "0x45": [6, 12], "chainid": [6, 12], "0x46": [6, 12], "selfbal": [6, 12], "0x47": [6, 12], "basefe": [6, 12], "0x48": [6, 12], "0x50": [6, 12], "mload": [6, 12, 21], "0x51": [6, 12], "mstore": [6, 12, 21], "0x52": [6, 12], "mstore8": [6, 12, 21], "0x53": [6, 12], "sload": [6, 12, 22], "0x54": [6, 12], "sstore": [6, 12, 22], "0x55": [6, 12], "0x56": [6, 12], "jumpi": [6, 12, 23], "0x57": [6, 12], "pc": [6, 7, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "0x58": [6, 12], "jumpdest": [6, 12, 23], "0x5b": [6, 12], "push1": [6, 7, 12], "0x60": [6, 8, 12], "push2": [6, 12], "0x61": [6, 12], "push3": [6, 12], "0x62": [6, 12], "push4": [6, 12], "0x63": [6, 12], "push5": [6, 12], "0x64": [6, 12], "push6": [6, 12], "0x65": [6, 12], "push7": [6, 12], "0x66": [6, 12], "push8": [6, 12], "0x67": [6, 12], "push9": [6, 12], "0x68": [6, 12], "push10": [6, 12], "0x69": [6, 12], "push11": [6, 12], "0x6a": [6, 12], "push12": [6, 12], "0x6b": [6, 12], "push13": [6, 12], "0x6c": [6, 12], "push14": [6, 12], "0x6d": [6, 12], "push15": [6, 12], "0x6e": [6, 12], "push16": [6, 12], "0x6f": [6, 12], "push17": [6, 12], "0x70": [6, 12], "push18": [6, 12], "0x71": [6, 12], "push19": [6, 12], "0x72": [6, 12], "push20": [6, 12], "0x73": [6, 12], "push21": [6, 12], "0x74": [6, 12], "push22": [6, 12], "0x75": [6, 12], "push23": [6, 12], "0x76": [6, 12], "push24": [6, 12], "0x77": [6, 12], "push25": [6, 12], "0x78": [6, 12], "push26": [6, 12], "0x79": [6, 12], "push27": [6, 12], "0x7a": [6, 12], "push28": [6, 12], "0x7b": [6, 12], "push29": [6, 12], "0x7c": [6, 12], "push30": [6, 12], "0x7d": [6, 12], "push31": [6, 12], "0x7e": [6, 12], "push32": [6, 12], "0x7f": [6, 12], "dup1": [6, 12], "0x80": [6, 12], "dup2": [6, 12], "0x81": [6, 12], "dup3": [6, 12], "0x82": [6, 12], "dup4": [6, 12], "0x83": [6, 12], "dup5": [6, 12], "0x84": [6, 12], "dup6": [6, 12], "0x85": [6, 12], "dup7": [6, 12], "0x86": [6, 12], "dup8": [6, 12], "0x87": [6, 12], "dup9": [6, 12], "0x88": [6, 12], "dup10": [6, 12], "0x89": [6, 12], "dup11": [6, 12], "0x8a": [6, 12], "dup12": [6, 12], "0x8b": [6, 12], "dup13": [6, 12], "0x8c": [6, 12], "dup14": [6, 12], "0x8d": [6, 12], "dup15": [6, 12], "0x8e": [6, 12], "dup16": [6, 12], "0x8f": [6, 12], "swap1": [6, 12], "0x90": [6, 12], "swap2": [6, 12], "0x91": [6, 12], "swap3": [6, 12], "0x92": [6, 12], "swap4": [6, 12], "0x93": [6, 12], "swap5": [6, 12], "0x94": [6, 12], "swap6": [6, 12], "0x95": [6, 12], "swap7": [6, 12], "0x96": [6, 12], "swap8": [6, 12], "0x97": [6, 12], "swap9": [6, 12], "0x98": [6, 12], "swap10": [6, 12], "0x99": [6, 12], "swap11": [6, 12], "0x9a": [6, 12], "swap12": [6, 12], "0x9b": [6, 12], "swap13": [6, 12], "0x9c": [6, 12], "swap14": [6, 12], "0x9d": [6, 12], "swap15": [6, 12], "0x9e": [6, 12], "swap16": [6, 12], "0x9f": [6, 12], "log0": [6, 12, 27], "0xa0": [6, 12], "log1": [6, 12, 27], "0xa1": [6, 12], "log2": [6, 12, 14, 27], "0xa2": [6, 12], "log3": [6, 12, 27], "0xa3": [6, 12], "log4": [6, 12, 27], "0xa4": [6, 12], "0xf0": [6, 12], "0xf1": [6, 12], "callcod": [6, 12], "0xf2": [6, 12], "legaci": [6, 12], "support": [6, 12], "fix": [6, 7, 9, 11, 12, 15, 17, 18, 23], "delegatecal": [6, 12], "0xf3": [6, 12], "0xf4": [6, 12], "create2": [6, 12], "0xf5": [6, 12], "staticcal": [6, 12], "0xfa": [6, 12], "revert": [6, 12, 28], "0xfd": [6, 12], "invalid": [6, 12], "0xfe": [6, 12], "selfdestruct": [6, 12], "0xff": [6, 8, 12], "captur": [7, 9, 15, 17, 23], "02_stack": 7, "ipynb": [7, 9, 15, 17, 23], "03_memori": 7, "04_storag": 7, "05_opcod": [7, 23], "06_stop": 7, "07_math": 7, "scratch": [7, 11], "book": 7, "content": 7, "ipykernel_5324": 7, "35317130": 7, "get_ipython": [7, 9, 15, 17, 23], "run_line_mag": [7, 9, 15, 17, 23], "librari": [7, 9, 15, 17, 18, 23], "python": [7, 9, 11, 15, 17, 18, 23], "lib": [7, 9, 15, 17, 23], "site": [7, 9, 15, 17, 23], "packag": [7, 9, 15, 17, 23], "ipython": [7, 9, 15, 17, 23], "core": [7, 9, 11, 15, 17, 23], "interactiveshel": [7, 9, 15, 17, 23], "magic_nam": [7, 9, 15, 17, 23], "_stack_depth": [7, 9, 15, 17, 23], "2416": [7, 9, 15, 17, 23], "kwarg": [7, 9, 15, 17, 23], "local_n": [7, 9, 15, 17, 23], "get_local_scop": [7, 9, 15, 17, 23], "stack_depth": [7, 9, 15, 17, 23], "2417": [7, 9, 15, 17, 23], "builtin_trap": [7, 9, 15, 17, 23], "2418": [7, 9, 15, 17, 23], "fn": [7, 9, 15, 17, 23], "arg": [7, 9, 15, 17, 23], "2419": [7, 9, 15, 17, 23], "2420": [7, 9, 15, 17, 23], "decor": [7, 9, 15, 17, 23], "fun": [7, 9, 15, 17, 23], "kw": [7, 9, 15, 17, 23], "230": [7, 9, 15, 17, 23], "kwsyntax": [7, 9, 15, 17, 23], "231": [7, 9, 15, 17, 23], "sig": [7, 9, 15, 17, 23], "232": [7, 9, 15, 17, 23], "func": [7, 9, 15, 17, 23], "extra": [7, 9, 15, 17, 23], "233": [7, 9, 15, 17, 23], "__name__": [7, 9, 15, 17, 23], "234": [7, 9, 15, 17, 23], "__doc__": [7, 9, 15, 17, 23], "magic": [7, 9, 15, 17, 23], "lambda": [7, 9, 14, 15, 17, 23], "f": [7, 9, 15, 17, 23, 27], "k": [7, 9, 15, 17, 23], "185": [7, 9, 15, 17, 23], "s": [7, 9, 11, 15, 17, 23], "overkil": [7, 9, 15, 17, 23], "just": [7, 9, 11, 14, 15, 17, 23], "state": [7, 9, 10, 15, 17, 23], "186": [7, 9, 15, 17, 23], "magic_deco": [7, 9, 15, 17, 23], "187": [7, 9, 15, 17, 23], "188": [7, 9, 15, 17, 23], "189": [7, 9, 15, 17, 23], "callabl": [7, 9, 15, 17, 23], "parameter_": [7, 9, 15, 17, 23], "runner": [7, 9, 15, 17, 23], "file_find": [7, 9, 15, 17, 23], "733": 7, "preserve_kei": 7, "shell": 7, "user_n": 7, "__file__": 7, "734": 7, "filenam": [7, 9, 15, 17, 23], "735": 7, "safe_execfile_ipi": 7, "raise_except": 7, "736": 7, "737": 7, "fname": 7, "shell_futur": 7, "2903": 7, "run_cel": 7, "silent": 7, "2904": 7, "2905": 7, "raise_error": 7, "2906": 7, "elif": 7, "success": 7, "2907": 7, "break": 7, "347": 7, "error_before_exec": 7, "348": 7, "error_in_exec": 7, "none": [7, 27], "349": 7, "350": 7, "351": 7, "__repr__": 7, "skip": 7, "hidden": 7, "frame": 7, "put": [7, 8], "everyth": 7, "togeth": [7, 8], "tell": 7, "calldata": [7, 19], "returndata": [7, 19, 28], "log": [7, 27], "peek": [7, 24], "gas_dec": [7, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28], "should_execute_next_opcod": 7, "op": 7, "_push": [7, 24], "talk": 8, "littl": [8, 14], "about": [8, 11, 14], "simpli": [8, 11], "operand": 8, "look": [8, 9, 10, 11, 17], "simple_push": 8, "0x6042": 8, "As": [8, 11], "see": [8, 11, 14, 17], "consist": 8, "both": [8, 14], "writer": 8, "sure": [8, 23, 25], "mix": 8, "what": [8, 10, 11, 17], "von": 8, "neumann": 8, "architectur": 8, "anoth": [8, 9, 15, 17, 23], "back": [8, 14], "onto": 8, "simple_add": [8, 9], "should": [8, 18, 21], "exactli": [8, 11, 14], "element": 8, "321": [8, 9], "step": 8, "built": [8, 11, 18], "oserror": [9, 15, 17, 23], "713": [9, 15, 17, 23], "fpath": [9, 15, 17, 23], "arg_lst": [9, 15, 17, 23], "714": [9, 15, 17, 23], "715": [9, 15, 17, 23], "indexerror": [9, 15, 17, 23], "util": [9, 15, 17, 23], "path": [9, 15, 17, 23], "get_py_filenam": [9, 15, 17, 23], "force_win32": [9, 15, 17, 23], "108": [9, 15, 17, 23], "109": [9, 15, 17, 23], "ioerror": [9, 15, 17, 23], "file": [9, 11, 15, 17, 23], "r": [9, 15, 17, 23], "110": [9, 15, 17, 23], "handl": [9, 14, 15, 17, 23], "abov": [9, 15, 17, 23], "occur": [9, 15, 17, 23], "ipykernel_5336": 9, "1196339088": 9, "723": [9, 15, 17, 23], "os": [9, 15, 17, 23], "nt": [9, 15, 17, 23], "re": [9, 15, 17, 23], "match": [9, 15, 17, 23], "724": [9, 15, 17, 23], "warn": [9, 15, 17, 23], "For": [9, 11, 15, 17, 23], "window": [9, 15, 17, 23], "doubl": [9, 15, 17, 23], "quot": [9, 15, 17, 23], "wrap": [9, 15, 17, 23], "mypath": [9, 15, 17, 23], "myfil": [9, 15, 17, 23], "725": [9, 15, 17, 23], "msg": [9, 15, 17, 23], "726": [9, 15, 17, 23], "727": [9, 15, 17, 23], "sy": [9, 15, 17, 23], "meta_path": [9, 15, 17, 23], "21_000": 9, "nameerror": 9, "1728536637": 9, "defin": 9, "consid": 10, "under": 10, "over": 10, "flow": 10, "protect": 10, "warm": [10, 19, 22], "cold": 10, "proof": 10, "stake": 10, "refund": [10, 22], "static": 10, "deleg": 10, "understand": [10, 11], "refer": [10, 11], "implemen": 10, "i": [10, 11, 17, 19], "highli": 10, "recommend": 10, "code": 10, "best": 10, "build": 11, "ever": 11, "develop": 11, "chanc": 11, "came": 11, "across": 11, "central": 11, "engin": 11, "respons": 11, "tutori": 11, "howev": 11, "omit": 11, "detail": 11, "believ": 11, "necessari": 11, "learn": 11, "principl": 11, "want": 11, "mini": 11, "version": 11, "real": 11, "But": [11, 15], "instead": 11, "separ": 11, "physic": 11, "done": 11, "softwar": 11, "own": 11, "languag": [11, 14], "subtract": [11, 15], "seen": 11, "tabl": 11, "below": 11, "halt": [11, 13], "addit": 11, "multipl": 11, "integ": 11, "divis": [11, 14], "importantli": 11, "doe": [11, 13], "know": 11, "604260005260206000f3": 11, "interpret": 11, "144": 11, "ad": [11, 15], "old": 11, "ones": 11, "deprec": 11, "quit": 11, "frequent": 11, "realli": 11, "don": 11, "write": 11, "slow": 11, "error": 11, "prone": 11, "high": 11, "level": 11, "solidii": 11, "text": 11, "translat": 11, "compil": 11, "target": 11, "special": 11, "compar": [11, 15], "blockchain": 11, "univers": 11, "ture": 11, "arbitrari": 11, "ignor": 11, "restrict": 11, "capabl": 11, "script": 11, "case": 11, "bottom": 11, "Then": 11, "move": 11, "live": 11, "total": 11, "isol": 11, "clue": 11, "account": 11, "outsid": 11, "world": 11, "mock": 11, "deliber": 11, "choic": 11, "avail": 11, "mistak": 11, "pleas": 11, "issu": 11, "even": 11, "better": 11, "pull": 11, "request": 11, "These": [14, 19], "increment": 14, "counter": [14, 23], "deduct": 14, "b": [14, 15, 16, 23], "One": [14, 21], "interest": 14, "note": [14, 18], "system": 14, "divid": 14, "Not": 14, "mostli": 14, "featur": 14, "solid": 14, "absolut": 14, "denomin": 14, "numer": 14, "small": 14, "helper": 14, "determin": 14, "sign": 14, "pos_or_neg": 14, "ab": 14, "dynam": 14, "mani": 14, "expon": 14, "binari": [14, 17], "size_in_byt": 14, "bits_need": 14, "ceil": 14, "10": [14, 17, 23], "50": 14, "inform": 14, "rare": 14, "x": [14, 17], "testbit": 14, "sign_bit": 14, "ipykernel_5367": 15, "3891275799": [15, 17], "rather": 15, "unsigned_to_sign": 15, "cpu": [15, 17, 19, 21, 23, 27], "familiar": 16, "_and": 16, "_or": 16, "_xor": 16, "_not": 16, "ipykernel_5379": 17, "again": 17, "word": [17, 21], "pow": 17, "bin": 17, "22": 17, "0b10110": 17, "0b1011000": 17, "0b101": 17, "1010": 17, "becom": 17, "101000": 17, "uint_255_negative_on": 17, "uint_256_max": 17, "hard": 18, "classifi": 18, "9": 18, "ineffici": 18, "decid": 18, "includ": 18, "itself": 18, "easili": 18, "been": 18, "weather": 18, "precomipl": 18, "matter": 18, "debat": 18, "commun": 18, "cryptograph": 18, "primit": 18, "characterist": 18, "messag": 18, "determinist": 18, "produc": 18, "output": 18, "infeas": 18, "invert": 18, "chaotic": 18, "whole": 18, "toatlli": 18, "extern": 18, "keccak": 18, "minimum_word_s": [18, 19], "dynamic_ga": [18, 19], "6": 18, "todo": [18, 21, 22, 27], "30": 18, "0x414b60745072088d013721b4a28a0559b1a9d213": 19, "99999999999": 19, "2600": 19, "100": [19, 22], "delta": 19, "until": 19, "destoffset": 19, "static_ga": [19, 27], "extcod": 19, "refactor": 19, "method": 19, "address_access_cost": 19, "blocknumb": 19, "0x1cbcfa1ffb1ca1ca8397d4f490194db5fc0543089b9dee43f76cf3f962a185e8": 19, "20": 19, "_pop": 20, "three": 21, "specifi": 21, "allow": 21, "right": 21, "align": 21, "2100": 22, "old_valu": 22, "base_dynamic_ga": 22, "test": 22, "20000": 22, "2900": 22, "access_cost": 22, "ipykernel_5691": 23, "3466750985": 23, "int": 24, "_dup": 25, "big": 25, "enough": 25, "_swap": 26, "value1": 26, "value2": 26, "topic1": 27, "topic2": 27, "topic3": 27, "topic4": 27, "calc_ga": 27, "topic_count": 27, "375": 27, "append_log": 27, "memeori": 27}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"build": 0, "evm": [0, 5, 7, 11], "from": 0, "scratch": 0, "video": 0, "seri": 0, "ga": [1, 5, 19], "stack": [2, 5], "memori": [3, 5, 6, 12], "advanc": 3, "storag": [4, 5, 6, 12], "warm": 4, "cold": 4, "state": [5, 6, 12], "program": [5, 7], "counter": [5, 7], "pc": 5, "valu": 5, "calldata": 5, "flag": 5, "returndata": 5, "log": [5, 6, 12], "opcod": [6, 12, 18], "implement": [6, 12], "list": 6, "math": [6, 12, 14], "comparison": [6, 12, 15], "logic": [6, 12, 16], "bit": [6, 12, 17], "op": [6, 12], "misc": [6, 12, 18], "ethereum": [6, 11, 12], "pop": [6, 12], "jump": [6, 12, 23], "push": [6, 8, 12], "dup": [6, 12], "swap": [6, 12], "contract": [6, 12], "bytecod": [8, 11], "simpl": 8, "instruct": 8, "data": [8, 19], "add": 8, "resourc": 10, "introduct": 11, "virut": 11, "machin": 11, "solid": 11, "vyper": 11, "huff": 11, "vs": [11, 18], "bitcoin": 11, "outlin": 11, "prerequisit": 11, "note": 11, "stop": 13, "less": 15, "than": 15, "sign": [15, 17], "greater": 15, "equal": 15, "Is": 15, "zero": 15, "And": 16, "Or": 16, "xor": 16, "Not": 16, "byte": 17, "shift": 17, "left": 17, "right": 17, "precompil": 18, "hash": [18, 19], "function": 18, "environ": 19, "address": 19, "balanc": 19, "origin": 19, "caller": 19, "callvalu": 19, "calldataload": 19, "calldatas": 19, "calldatacopi": 19, "codes": 19, "codecopi": 19, "price": 19, "extern": 19, "code": 19, "size": 19, "copi": 19, "return": 19, "block": 19, "coinbas": 19}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.intersphinx": 1, "sphinxcontrib.bibtex": 9, "sphinx": 56}}) \ No newline at end of file +Search.setIndex({"docnames": ["README", "content/02_a_gas", "content/02_stack", "content/03_memory", "content/04_storage", "content/05_1_state", "content/05_opcodes", "content/24_evm", "content/25_bytecode", "content/26_run", "content/99_conclusion", "content/intro", "content/opcodes", "content/opcodes/06_stop", "content/opcodes/07_math", "content/opcodes/08_comparisions", "content/opcodes/09_logic", "content/opcodes/10_bit", "content/opcodes/11_misc", "content/opcodes/12_environment", "content/opcodes/13_pop", "content/opcodes/14_memory", "content/opcodes/15_storage", "content/opcodes/16_jump", "content/opcodes/17_push", "content/opcodes/18_dup", "content/opcodes/19_swap", "content/opcodes/20_log", "content/opcodes/21_contract"], "filenames": ["README.md", "content/02_a_gas.ipynb", "content/02_stack.ipynb", "content/03_memory.ipynb", "content/04_storage.ipynb", "content/05_1_state.ipynb", "content/05_opcodes.ipynb", "content/24_evm.ipynb", "content/25_bytecode.ipynb", "content/26_run.ipynb", "content/99_conclusion.ipynb", "content/intro.ipynb", "content/opcodes.ipynb", "content/opcodes/06_stop.ipynb", "content/opcodes/07_math.ipynb", "content/opcodes/08_comparisions.ipynb", "content/opcodes/09_logic.ipynb", "content/opcodes/10_bit.ipynb", "content/opcodes/11_misc.ipynb", "content/opcodes/12_environment.ipynb", "content/opcodes/13_pop.ipynb", "content/opcodes/14_memory.ipynb", "content/opcodes/15_storage.ipynb", "content/opcodes/16_jump.ipynb", "content/opcodes/17_push.ipynb", "content/opcodes/18_dup.ipynb", "content/opcodes/19_swap.ipynb", "content/opcodes/20_log.ipynb", "content/opcodes/21_contract.ipynb"], "titles": ["Building the EVM from Scratch", "Gas", "Stack", "Memory", "Storage", "EVM State", "Opcodes", "EVM", "Bytecode", "<no title>", "Resources", "Introduction", "Opcodes", "Stop", "Math", "Comparisons", "Logic", "Bit", "Misc", "Environment", "<no title>", "<no title>", "<no title>", "Jump", "<no title>", "<no title>", "<no title>", "<no title>", "<no title>"], "terms": {"we": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 18, 19, 23], "ar": [0, 1, 2, 5, 6, 7, 8, 10, 11, 12, 14, 16, 18, 19, 21], "go": [0, 5, 7, 11, 14], "ethereum": [0, 5, 18, 19], "virtual": [0, 11], "machin": [0, 5], "everi": [0, 2, 4, 6, 11, 12, 18, 19], "major": 0, "topic": [0, 27], "cover": 0, "seper": [0, 19], "jupyt": 0, "notebook": [0, 6, 11, 12], "In": [0, 6, 8, 11, 12, 14], "end": [0, 11, 14], "combin": [0, 3, 11], "all": [0, 4, 5, 6, 11, 12, 13, 14], "block": [0, 3, 11], "creat": [0, 2, 3, 6, 11, 12, 18], "you": [0, 1, 2, 8, 10, 11, 14, 16, 19], "can": [0, 2, 3, 4, 5, 6, 8, 11, 12, 18, 19, 23], "view": 0, "directli": [0, 2, 11, 14, 18], "github": [0, 11], "download": 0, "repositori": 0, "execut": [0, 1, 3, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 17, 18, 19, 23], "plai": 0, "around": 0, "local": [0, 19], "A": [0, 2, 3, 4, 5, 6, 11, 12, 18, 21], "come": [0, 11], "soon": 0, "And": [0, 5], "upload": 0, "my": 0, "shafu": 0, "page": 0, "youtub": 0, "veri": [1, 2, 6, 11, 12, 13, 15, 16, 18], "import": [1, 11, 14, 18, 21], "concept": [1, 11, 16, 17], "It": [1, 2, 3, 4, 5, 7, 8, 11, 14, 18], "measur": 1, "amount": [1, 4, 7], "comput": [1, 4, 11], "work": [1, 2, 11, 14], "That": [1, 6, 11, 12, 19], "could": [1, 8, 11, 18], "store": [1, 3, 4, 5, 19, 21, 22], "valu": [1, 2, 3, 4, 7, 14, 15, 17, 18, 19, 21, 22, 24, 25, 27], "storag": [1, 7, 11, 22], "expand": [1, 3], "size": [1, 3, 18, 27, 28], "memori": [1, 7, 11, 18, 19, 21, 27, 28], "an": [1, 2, 3, 4, 5, 6, 11, 12, 14, 18, 21, 23], "arithmet": [1, 6, 12, 14, 15], "oper": [1, 5, 6, 11, 12, 14, 16, 17, 18], "need": [1, 3, 5, 11, 14], "becaus": [1, 6, 11, 12, 19], "ressourc": 1, "do": [1, 10, 11, 18, 22], "limit": 1, "so": [1, 11, 18, 19], "order": 1, "avoid": 1, "ddo": 1, "attack": 1, "exampl": 1, "user": [1, 11], "spend": 1, "some": [1, 3, 6, 11, 12, 14], "run": [1, 7, 9, 11, 15, 17, 19, 23], "hi": 1, "program": [1, 8, 11, 14, 18, 19, 23], "ha": [1, 2, 6, 11, 12, 18, 19], "paid": 1, "eth": 1, "If": [1, 4, 5, 10, 11], "out": [1, 7], "while": [1, 7], "your": [1, 4, 11], "bytecod": [1, 5, 7, 9, 18], "stop": [1, 5, 6, 7, 11, 12], "The": [2, 3, 4, 5, 7, 8, 11, 14, 18, 19], "simpl": [2, 3, 11, 13], "data": [2, 5, 27], "structur": [2, 6, 12], "list": [2, 3, 8, 11], "one": [2, 5, 6, 7, 8, 9, 12, 14, 15, 17, 18, 19, 21, 23], "restrction": 2, "onli": [2, 11, 18, 19, 23], "interact": [2, 11], "top": 2, "push": [2, 7, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25], "new": [2, 11], "pop": [2, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27, 28], "alreadi": [2, 5, 11], "exist": 2, "from": [2, 3, 4, 7, 11, 14, 17, 19], "plate": 2, "good": [2, 11], "metaphor": 2, "add": [2, 3, 6, 7, 11, 12, 14], "remov": 2, "exact": 2, "same": [2, 16, 17, 18, 19], "wai": [2, 3, 18], "evm": [2, 6, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "maximum": 2, "capac": 2, "1024": 2, "item": 2, "max": 2, "256": [2, 14, 17, 18, 19], "bit": [2, 3, 7, 9, 15, 18, 23], "32": [2, 3, 4, 17, 18, 19, 21], "byte": [2, 3, 4, 6, 12, 14, 19, 21], "maximum_stack_s": 2, "also": [2, 3, 11, 14, 18], "throw": [2, 4, 14], "except": [2, 4, 7, 9, 14, 15, 17, 19, 23], "try": [2, 14], "empti": [2, 3], "class": [2, 3, 4, 5, 7, 27], "def": [2, 3, 4, 5, 6, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "__init__": [2, 3, 4, 5, 7, 27], "self": [2, 3, 4, 5, 7, 9, 15, 17, 23, 27], "__str__": [2, 27], "return": [2, 3, 4, 5, 6, 7, 9, 12, 14, 15, 17, 23, 27], "n": [2, 7, 14, 20, 24, 25, 26], "join": [2, 24], "map": [2, 4, 24], "str": [2, 18, 24], "1": [2, 3, 4, 6, 7, 9, 12, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28], "len": [2, 3, 7, 19], "rais": [2, 7, 9, 15, 17, 19, 23], "overflow": 2, "append": [2, 3, 4, 19, 24], "0": [2, 3, 4, 5, 7, 9, 14, 15, 17, 19, 22, 23, 26, 27, 28], "underflow": 2, "del": 2, "3": [2, 3, 7, 9, 14, 15, 16, 17, 19, 23, 24, 25, 26, 27], "2": [2, 3, 7, 9, 14, 17, 19, 20, 23, 27], "4": [2, 3, 7, 27], "print": [2, 7, 9], "typeerror": [2, 7, 9, 15, 17, 23], "traceback": [2, 7, 9, 15, 17, 23], "most": [2, 5, 6, 7, 9, 11, 12, 14, 15, 17, 18, 19, 23], "recent": [2, 7, 9, 15, 17, 19, 23], "call": [2, 6, 7, 8, 9, 10, 11, 12, 15, 17, 18, 19, 23], "last": [2, 7, 9, 15, 17, 19, 23], "var": [2, 7, 9, 15, 17, 23], "folder": [2, 7, 9, 15, 17, 23], "08": [2, 7, 9, 15, 17, 23], "q0syv9y576b_rnls32m9d3nr0000gn": [2, 7, 9, 15, 17, 23], "t": [2, 7, 9, 11, 15, 17, 23], "ipykernel_6186": 2, "1192403925": [2, 7], "py": [2, 7, 9, 10, 15, 17, 23], "cell": [2, 3, 7, 9, 15, 17, 23], "line": [2, 7, 9, 15, 17, 23], "miss": [2, 7], "requir": [2, 7], "posit": [2, 7, 17], "argument": [2, 7], "now": [2, 4, 7, 8, 16], "left": 2, "each": [3, 6, 12], "access": [3, 4, 10, 18, 19, 27, 28], "individu": 3, "similar": [3, 15], "ram": 3, "start": [3, 11], "being": 3, "complet": [3, 11, 19], "volatil": [3, 4], "which": [3, 5, 7, 11], "mean": [3, 11], "after": [3, 5, 8, 11], "reset": [3, 7], "hold": 3, "8": [3, 7, 9, 14, 15, 17, 23, 27], "number": [3, 4, 6, 11, 12, 14], "between": 3, "255": 3, "repres": [3, 4, 6, 12, 14], "index": [3, 7], "offset": [3, 18, 19, 21, 27, 28], "would": [3, 8, 11, 14, 18], "get": [3, 17, 19, 26], "5": [3, 7, 14], "7": [3, 14], "simplememori": 3, "load": [3, 4, 21, 22], "consum": [3, 5, 14], "ga": [3, 4, 7, 9, 10, 11, 14, 18], "non": [3, 4], "linearli": 3, "make": [3, 5, 6, 8, 11, 12, 23, 25], "more": [3, 4, 8, 14], "costli": 3, "larger": [3, 6, 12], "space": 3, "let": [3, 14, 17, 21], "expans": [3, 27], "calcul": [3, 14, 18], "memory_expansion_cost": [3, 18, 19, 27], "expansion_s": 3, "initi": [3, 4], "zero": 3, "0x00": [3, 4, 11, 19], "_": [3, 24], "rang": [3, 24], "extend": 3, "simplifi": [3, 11, 19], "super": [3, 4], "0x01": [3, 8, 11], "0x02": [3, 11], "0x03": [3, 11], "0x04": [3, 11], "alwai": [3, 19], "thi": [3, 4, 5, 6, 8, 11, 12, 14, 16, 18, 19], "actual": [3, 8, 14], "how": [3, 4, 5, 11, 14], "cost": [3, 4, 14, 27], "calc_memory_expansion_ga": 3, "memory_byte_s": 3, "memory_size_word": 3, "31": [3, 14, 17, 18, 19], "memory_cost": 3, "512": 3, "round": 3, "kei": [4, 22], "practic": [4, 18], "purpos": 4, "infinit": 4, "up": [4, 8, 9, 11], "like": [4, 6, 8, 10, 11, 12, 14, 17], "ssd": 4, "sourc": [4, 18], "http": 4, "doc": 4, "alchemi": 4, "com": 4, "smart": [4, 11], "contract": [4, 11], "layout": 4, "dictionari": 4, "keyvalu": 4, "differ": [4, 6, 12, 16], "whether": [4, 11], "slot": 4, "said": [4, 11], "wa": [4, 18], "befor": [4, 11], "otherwis": 4, "than": [4, 6, 12], "implement": [4, 11, 14, 18], "logic": 4, "keep": [4, 5, 11], "track": [4, 5], "cach": 4, "when": [4, 5], "save": [4, 5, 21], "its": [4, 11, 18, 19], "true": [4, 5, 7, 13, 28], "els": [4, 9, 14, 15, 17, 19, 22, 23], "fals": [4, 5, 7], "420": 4, "notic": 4, "first": [4, 11, 13, 14], "time": [4, 11, 18], "retriev": 4, "someth": [4, 11], "read": 4, "random": [4, 18], "set": [4, 9, 13, 26], "ani": [4, 11, 18], "42069": 4, "valid": [5, 8, 11], "manipul": [5, 6, 12, 14], "specif": 5, "opcod": [5, 7, 8, 10, 11, 13, 14, 15, 19, 21, 23], "point": 5, "next": [5, 6, 7, 8], "them": [5, 6, 8, 11, 12, 14, 15, 18], "part": [5, 11, 19], "area": 5, "where": [5, 11], "current": [5, 6, 11, 12, 18, 19], "chang": [5, 11, 18], "dure": [5, 9, 15, 17, 23], "immut": 5, "address": [5, 6, 12], "account": [5, 11, 19], "equival": 5, "msg": [5, 9, 15, 17, 19, 23], "solid": [5, 14, 19], "much": 5, "have": [5, 6, 8, 11, 12, 18], "down": 5, "ether": [5, 19], "wei": [5, 19], "Is": 5, "input": [5, 11, 18, 19], "our": [5, 11, 13, 19], "two": [5, 21], "stop_flag": [5, 7, 13, 28], "revert_flag": [5, 7, 28], "There": [5, 6, 11, 12, 19, 21], "sever": 5, "emit": 5, "result": [5, 7, 8, 9, 14, 15, 17, 23], "here": [5, 6, 8, 11, 12, 14], "insturct": [6, 12], "categori": [6, 12], "other": [6, 11, 12, 14, 19], "deal": [6, 12], "stack": [6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "follow": [6, 12, 18], "thing": [6, 10, 11, 12], "common": [6, 12], "thei": [6, 10, 11, 12, 18], "why": [6, 11, 12, 19], "function": [6, 11, 12, 14], "take": [6, 9, 11, 12], "instanc": [6, 12], "paramet": [6, 12], "uniqu": [6, 12], "identifi": [6, 11, 12], "convini": [6, 12], "denot": [6, 12], "hexadecim": [6, 11, 12], "To": [6, 12], "easier": [6, 12], "us": [6, 8, 9, 11, 12, 14, 15, 17, 18, 19, 21, 23], "give": [6, 12, 19], "short": [6, 12], "descript": [6, 11, 12], "name": [6, 9, 11, 12, 15, 17, 23], "found": [6, 9, 12, 15, 17, 23], "0x0": [6, 12], "0x1": [6, 12], "mul": [6, 11, 12, 14], "0x2": [6, 12], "sub": [6, 11, 12, 14], "0x3": [6, 12], "div": [6, 11, 12, 14], "0x4": [6, 12], "sdiv": [6, 12, 14], "0x5": [6, 12], "mod": [6, 12, 14], "0x6": [6, 12], "smod": [6, 12, 14], "0x7": [6, 12], "addmod": [6, 12, 14], "0x8": [6, 12], "mulmod": [6, 12, 14], "0x9": [6, 12], "exp": [6, 12, 14], "0xa": [6, 12], "signextend": [6, 12, 14], "0xb": [6, 12], "lt": [6, 12, 15], "0x10": [6, 12], "gt": [6, 12, 15], "0x11": [6, 12], "slt": [6, 12, 15], "0x12": [6, 12], "sgt": [6, 12, 15], "0x13": [6, 12], "eq": [6, 12, 15], "0x14": [6, 12], "iszero": [6, 12, 15], "0x15": [6, 12], "AND": [6, 12], "0x16": [6, 12], "OR": [6, 12], "0x17": [6, 12], "xor": [6, 12], "0x18": [6, 12], "NOT": [6, 11, 12], "0x19": [6, 12], "0x1a": [6, 12], "shl": [6, 12, 17], "0x1b": [6, 12], "shr": [6, 12, 17], "0x1c": [6, 12], "sar": [6, 12, 17], "0x1d": [6, 12], "sha3": [6, 12, 18], "0x20": [6, 12], "0x30": [6, 12], "balanc": [6, 12], "0x31": [6, 12], "origin": [6, 12], "0x32": [6, 12], "caller": [6, 7, 9, 12, 15, 17, 23], "0x33": [6, 12], "callvalu": [6, 12], "0x34": [6, 12], "calldataload": [6, 12], "0x35": [6, 12], "calldatas": [6, 12], "0x36": [6, 12], "calldatacopi": [6, 12], "0x37": [6, 12], "codes": [6, 12], "0x38": [6, 12], "codecopi": [6, 12], "0x39": [6, 12], "gaspric": [6, 12, 19], "0x3a": [6, 12], "extcodes": [6, 10, 12, 19], "0x3b": [6, 12], "extcodecopi": [6, 12, 19], "0x3c": [6, 12], "returndatas": [6, 12, 19], "0x3d": [6, 12], "returndatacopi": [6, 12, 19], "0x3e": [6, 12], "extcodehash": [6, 12, 19], "0x3f": [6, 12], "blockhash": [6, 12, 19], "0x40": [6, 12], "coinbas": [6, 12], "0x41": [6, 12], "timestamp": [6, 12], "0x42": [6, 8, 12], "0x43": [6, 12], "difficulti": [6, 12], "0x44": [6, 12], "gaslimit": [6, 12], "0x45": [6, 12], "chainid": [6, 12], "0x46": [6, 12], "selfbal": [6, 12], "0x47": [6, 12], "basefe": [6, 12], "0x48": [6, 12], "0x50": [6, 12], "mload": [6, 12, 21], "0x51": [6, 12], "mstore": [6, 12, 21], "0x52": [6, 12], "mstore8": [6, 12, 21], "0x53": [6, 12], "sload": [6, 12, 22], "0x54": [6, 12], "sstore": [6, 12, 22], "0x55": [6, 12], "0x56": [6, 12], "jumpi": [6, 12, 23], "0x57": [6, 12], "pc": [6, 7, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], "0x58": [6, 12], "jumpdest": [6, 12, 23], "0x5b": [6, 12], "push1": [6, 7, 12], "0x60": [6, 8, 12], "push2": [6, 12], "0x61": [6, 12], "push3": [6, 12], "0x62": [6, 12], "push4": [6, 12], "0x63": [6, 12], "push5": [6, 12], "0x64": [6, 12], "push6": [6, 12], "0x65": [6, 12], "push7": [6, 12], "0x66": [6, 12], "push8": [6, 12], "0x67": [6, 12], "push9": [6, 12], "0x68": [6, 12], "push10": [6, 12], "0x69": [6, 12], "push11": [6, 12], "0x6a": [6, 12], "push12": [6, 12], "0x6b": [6, 12], "push13": [6, 12], "0x6c": [6, 12], "push14": [6, 12], "0x6d": [6, 12], "push15": [6, 12], "0x6e": [6, 12], "push16": [6, 12], "0x6f": [6, 12], "push17": [6, 12], "0x70": [6, 12], "push18": [6, 12], "0x71": [6, 12], "push19": [6, 12], "0x72": [6, 12], "push20": [6, 12], "0x73": [6, 12], "push21": [6, 12], "0x74": [6, 12], "push22": [6, 12], "0x75": [6, 12], "push23": [6, 12], "0x76": [6, 12], "push24": [6, 12], "0x77": [6, 12], "push25": [6, 12], "0x78": [6, 12], "push26": [6, 12], "0x79": [6, 12], "push27": [6, 12], "0x7a": [6, 12], "push28": [6, 12], "0x7b": [6, 12], "push29": [6, 12], "0x7c": [6, 12], "push30": [6, 12], "0x7d": [6, 12], "push31": [6, 12], "0x7e": [6, 12], "push32": [6, 12], "0x7f": [6, 12], "dup1": [6, 12], "0x80": [6, 12], "dup2": [6, 12], "0x81": [6, 12], "dup3": [6, 12], "0x82": [6, 12], "dup4": [6, 12], "0x83": [6, 12], "dup5": [6, 12], "0x84": [6, 12], "dup6": [6, 12], "0x85": [6, 12], "dup7": [6, 12], "0x86": [6, 12], "dup8": [6, 12], "0x87": [6, 12], "dup9": [6, 12], "0x88": [6, 12], "dup10": [6, 12], "0x89": [6, 12], "dup11": [6, 12], "0x8a": [6, 12], "dup12": [6, 12], "0x8b": [6, 12], "dup13": [6, 12], "0x8c": [6, 12], "dup14": [6, 12], "0x8d": [6, 12], "dup15": [6, 12], "0x8e": [6, 12], "dup16": [6, 12], "0x8f": [6, 12], "swap1": [6, 12], "0x90": [6, 12], "swap2": [6, 12], "0x91": [6, 12], "swap3": [6, 12], "0x92": [6, 12], "swap4": [6, 12], "0x93": [6, 12], "swap5": [6, 12], "0x94": [6, 12], "swap6": [6, 12], "0x95": [6, 12], "swap7": [6, 12], "0x96": [6, 12], "swap8": [6, 12], "0x97": [6, 12], "swap9": [6, 12], "0x98": [6, 12], "swap10": [6, 12], "0x99": [6, 12], "swap11": [6, 12], "0x9a": [6, 12], "swap12": [6, 12], "0x9b": [6, 12], "swap13": [6, 12], "0x9c": [6, 12], "swap14": [6, 12], "0x9d": [6, 12], "swap15": [6, 12], "0x9e": [6, 12], "swap16": [6, 12], "0x9f": [6, 12], "log0": [6, 12, 27], "0xa0": [6, 12], "log1": [6, 12, 27], "0xa1": [6, 12], "log2": [6, 12, 14, 27], "0xa2": [6, 12], "log3": [6, 12, 27], "0xa3": [6, 12], "log4": [6, 12, 27], "0xa4": [6, 12], "0xf0": [6, 12], "0xf1": [6, 12], "callcod": [6, 12], "0xf2": [6, 12], "legaci": [6, 12], "support": [6, 12], "fix": [6, 7, 9, 11, 12, 15, 17, 18, 23], "delegatecal": [6, 12], "0xf3": [6, 12], "0xf4": [6, 12], "create2": [6, 12], "0xf5": [6, 12], "staticcal": [6, 12], "0xfa": [6, 12], "revert": [6, 12, 28], "0xfd": [6, 12], "invalid": [6, 12], "0xfe": [6, 12], "selfdestruct": [6, 12], "0xff": [6, 8, 12], "captur": [7, 9, 15, 17, 23], "02_stack": 7, "ipynb": [7, 9, 15, 17, 23], "03_memori": 7, "04_storag": 7, "05_opcod": [7, 23], "06_stop": 7, "07_math": 7, "scratch": [7, 11], "book": 7, "content": 7, "ipykernel_6212": 7, "35317130": 7, "get_ipython": [7, 9, 15, 17, 23], "run_line_mag": [7, 9, 15, 17, 23], "librari": [7, 9, 15, 17, 18, 23], "python": [7, 9, 11, 15, 17, 18, 23], "lib": [7, 9, 15, 17, 23], "site": [7, 9, 15, 17, 23], "packag": [7, 9, 15, 17, 23], "ipython": [7, 9, 15, 17, 23], "core": [7, 9, 11, 15, 17, 23], "interactiveshel": [7, 9, 15, 17, 23], "magic_nam": [7, 9, 15, 17, 23], "_stack_depth": [7, 9, 15, 17, 23], "2416": [7, 9, 15, 17, 23], "kwarg": [7, 9, 15, 17, 23], "local_n": [7, 9, 15, 17, 23], "get_local_scop": [7, 9, 15, 17, 23], "stack_depth": [7, 9, 15, 17, 23], "2417": [7, 9, 15, 17, 23], "builtin_trap": [7, 9, 15, 17, 23], "2418": [7, 9, 15, 17, 23], "fn": [7, 9, 15, 17, 23], "arg": [7, 9, 15, 17, 23], "2419": [7, 9, 15, 17, 23], "2420": [7, 9, 15, 17, 23], "decor": [7, 9, 15, 17, 23], "fun": [7, 9, 15, 17, 23], "kw": [7, 9, 15, 17, 23], "230": [7, 9, 15, 17, 23], "kwsyntax": [7, 9, 15, 17, 23], "231": [7, 9, 15, 17, 23], "sig": [7, 9, 15, 17, 23], "232": [7, 9, 15, 17, 23], "func": [7, 9, 15, 17, 23], "extra": [7, 9, 15, 17, 23], "233": [7, 9, 15, 17, 23], "__name__": [7, 9, 15, 17, 23], "234": [7, 9, 15, 17, 23], "__doc__": [7, 9, 15, 17, 23], "magic": [7, 9, 15, 17, 23], "lambda": [7, 9, 14, 15, 17, 23], "f": [7, 9, 15, 17, 23, 27], "k": [7, 9, 15, 17, 23], "185": [7, 9, 15, 17, 23], "s": [7, 9, 11, 15, 17, 23], "overkil": [7, 9, 15, 17, 23], "just": [7, 9, 11, 14, 15, 17, 23], "state": [7, 9, 10, 15, 17, 23], "186": [7, 9, 15, 17, 23], "magic_deco": [7, 9, 15, 17, 23], "187": [7, 9, 15, 17, 23], "188": [7, 9, 15, 17, 23], "189": [7, 9, 15, 17, 23], "callabl": [7, 9, 15, 17, 23], "parameter_": [7, 9, 15, 17, 23], "runner": [7, 9, 15, 17, 23], "file_find": [7, 9, 15, 17, 23], "733": 7, "preserve_kei": 7, "shell": 7, "user_n": 7, "__file__": 7, "734": 7, "filenam": [7, 9, 15, 17, 23], "735": 7, "safe_execfile_ipi": 7, "raise_except": 7, "736": 7, "737": 7, "fname": 7, "shell_futur": 7, "2903": 7, "run_cel": 7, "silent": 7, "2904": 7, "2905": 7, "raise_error": 7, "2906": 7, "elif": 7, "success": 7, "2907": 7, "break": 7, "347": 7, "error_before_exec": 7, "348": 7, "error_in_exec": 7, "none": [7, 27], "349": 7, "350": 7, "351": 7, "__repr__": 7, "skip": 7, "hidden": 7, "frame": 7, "put": [7, 8, 19], "everyth": [7, 19], "togeth": [7, 8], "tell": 7, "calldata": [7, 19], "returndata": [7, 19, 28], "log": [7, 27], "peek": [7, 24], "gas_dec": [7, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28], "should_execute_next_opcod": 7, "op": 7, "_push": [7, 24], "talk": 8, "littl": [8, 14], "about": [8, 11, 14], "simpli": [8, 11, 19], "operand": 8, "look": [8, 9, 10, 11, 17], "simple_push": 8, "0x6042": 8, "As": [8, 11, 19], "see": [8, 11, 14, 17], "consist": 8, "both": [8, 14], "writer": 8, "sure": [8, 23, 25], "mix": 8, "what": [8, 10, 11, 17], "von": 8, "neumann": 8, "architectur": 8, "anoth": [8, 9, 15, 17, 19, 23], "back": [8, 14], "onto": 8, "simple_add": [8, 9], "should": [8, 18, 21], "exactli": [8, 11, 14], "element": 8, "321": [8, 9], "step": 8, "built": [8, 11, 18], "oserror": [9, 15, 17, 23], "713": [9, 15, 17, 23], "fpath": [9, 15, 17, 23], "arg_lst": [9, 15, 17, 23], "714": [9, 15, 17, 23], "715": [9, 15, 17, 23], "indexerror": [9, 15, 17, 23], "util": [9, 15, 17, 23], "path": [9, 15, 17, 23], "get_py_filenam": [9, 15, 17, 23], "force_win32": [9, 15, 17, 23], "108": [9, 15, 17, 23], "109": [9, 15, 17, 23], "ioerror": [9, 15, 17, 23], "file": [9, 11, 15, 17, 23], "r": [9, 15, 17, 23], "110": [9, 15, 17, 23], "handl": [9, 14, 15, 17, 23], "abov": [9, 15, 17, 23], "occur": [9, 15, 17, 23], "ipykernel_6222": 9, "1196339088": 9, "723": [9, 15, 17, 23], "os": [9, 15, 17, 23], "nt": [9, 15, 17, 23], "re": [9, 15, 17, 23], "match": [9, 15, 17, 23], "724": [9, 15, 17, 23], "warn": [9, 15, 17, 23], "For": [9, 11, 15, 17, 19, 23], "window": [9, 15, 17, 23], "doubl": [9, 15, 17, 23], "quot": [9, 15, 17, 23], "wrap": [9, 15, 17, 23], "mypath": [9, 15, 17, 23], "myfil": [9, 15, 17, 23], "725": [9, 15, 17, 23], "726": [9, 15, 17, 23], "727": [9, 15, 17, 23], "sy": [9, 15, 17, 23], "meta_path": [9, 15, 17, 23], "21_000": 9, "nameerror": 9, "1728536637": 9, "defin": 9, "consid": 10, "under": 10, "over": 10, "flow": 10, "protect": 10, "warm": [10, 19, 22], "cold": 10, "proof": 10, "stake": 10, "refund": [10, 22], "static": 10, "deleg": 10, "understand": [10, 11], "refer": [10, 11], "implemen": 10, "i": [10, 11, 17, 19], "highli": 10, "recommend": 10, "code": 10, "best": 10, "build": 11, "ever": 11, "develop": 11, "chanc": 11, "came": 11, "across": 11, "central": 11, "engin": 11, "respons": 11, "tutori": 11, "howev": 11, "omit": 11, "detail": 11, "believ": 11, "necessari": 11, "learn": 11, "principl": 11, "want": 11, "mini": 11, "version": 11, "real": 11, "But": [11, 15], "instead": 11, "separ": 11, "physic": 11, "done": 11, "softwar": 11, "own": 11, "languag": [11, 14], "subtract": [11, 15], "seen": 11, "tabl": 11, "below": 11, "halt": [11, 13], "addit": 11, "multipl": 11, "integ": 11, "divis": [11, 14], "importantli": 11, "doe": [11, 13], "know": 11, "604260005260206000f3": 11, "interpret": 11, "144": 11, "ad": [11, 15], "old": 11, "ones": 11, "deprec": 11, "quit": 11, "frequent": 11, "realli": 11, "don": 11, "write": 11, "slow": 11, "error": 11, "prone": 11, "high": 11, "level": 11, "text": 11, "translat": 11, "compil": 11, "target": 11, "special": 11, "compar": [11, 15], "blockchain": 11, "univers": 11, "ture": 11, "arbitrari": 11, "ignor": 11, "restrict": 11, "capabl": 11, "script": 11, "case": 11, "bottom": 11, "Then": 11, "move": 11, "live": 11, "total": 11, "isol": 11, "clue": 11, "outsid": 11, "world": [11, 19], "mock": [11, 19], "deliber": 11, "choic": 11, "avail": 11, "mistak": 11, "pleas": 11, "issu": 11, "even": 11, "better": 11, "pull": 11, "request": 11, "These": [14, 19], "increment": 14, "counter": [14, 23], "deduct": 14, "b": [14, 15, 16, 23], "One": [14, 21], "interest": 14, "note": [14, 18], "system": 14, "divid": 14, "Not": 14, "mostli": 14, "featur": 14, "absolut": 14, "denomin": 14, "numer": 14, "small": 14, "helper": 14, "determin": 14, "sign": 14, "pos_or_neg": 14, "ab": 14, "dynam": 14, "mani": 14, "expon": 14, "binari": [14, 17], "size_in_byt": 14, "bits_need": 14, "ceil": 14, "10": [14, 17, 23], "50": 14, "inform": 14, "rare": 14, "x": [14, 17], "testbit": 14, "sign_bit": 14, "ipykernel_6252": 15, "3891275799": [15, 17], "rather": 15, "unsigned_to_sign": 15, "cpu": [15, 17, 19, 21, 23, 27], "familiar": 16, "_and": 16, "_or": 16, "_xor": 16, "_not": 16, "ipykernel_6264": 17, "again": 17, "word": [17, 21], "pow": 17, "bin": 17, "22": 17, "0b10110": 17, "0b1011000": 17, "0b101": 17, "1010": 17, "becom": 17, "101000": 17, "uint_255_negative_on": 17, "uint_256_max": 17, "hard": 18, "classifi": 18, "9": 18, "ineffici": 18, "decid": 18, "includ": 18, "itself": 18, "easili": 18, "been": 18, "weather": 18, "precomipl": 18, "matter": 18, "debat": 18, "commun": 18, "cryptograph": 18, "primit": 18, "characterist": 18, "messag": 18, "determinist": 18, "produc": 18, "output": [18, 19], "infeas": 18, "invert": 18, "chaotic": 18, "whole": 18, "toatlli": 18, "extern": 18, "keccak": 18, "minimum_word_s": [18, 19], "dynamic_ga": [18, 19], "6": 18, "todo": [18, 21, 22, 27], "30": 18, "sender": 19, "given": 19, "99999999999": 19, "2600": 19, "100": [19, 22], "trigger": 19, "tx": 19, "equal": 19, "0x414b60745072088d013721b4a28a0559b1a9d213": 19, "provid": 19, "delta": 19, "until": 19, "specifi": [19, 21], "destoffset": 19, "static_ga": [19, 27], "extcod": 19, "refactor": 19, "method": 19, "address_access_cost": 19, "previou": 19, "therefor": 19, "blocknumb": 19, "0x1cbcfa1ffb1ca1ca8397d4f490194db5fc0543089b9dee43f76cf3f962a185e8": 19, "20": 19, "miner": 19, "_pop": 20, "three": 21, "allow": 21, "right": 21, "align": 21, "2100": 22, "old_valu": 22, "base_dynamic_ga": 22, "test": 22, "20000": 22, "2900": 22, "access_cost": 22, "ipykernel_6294": 23, "3466750985": 23, "int": 24, "_dup": 25, "big": 25, "enough": 25, "_swap": 26, "value1": 26, "value2": 26, "topic1": 27, "topic2": 27, "topic3": 27, "topic4": 27, "calc_ga": 27, "topic_count": 27, "375": 27, "append_log": 27, "memeori": 27}, "objects": {}, "objtypes": {}, "objnames": {}, "titleterms": {"build": 0, "evm": [0, 5, 7, 11], "from": 0, "scratch": 0, "video": 0, "seri": 0, "ga": [1, 5, 19], "stack": [2, 5], "memori": [3, 5, 6, 12], "advanc": 3, "storag": [4, 5, 6, 12], "warm": 4, "cold": 4, "state": [5, 6, 12], "program": [5, 7], "counter": [5, 7], "pc": 5, "sender": 5, "valu": 5, "calldata": 5, "flag": 5, "returndata": 5, "log": [5, 6, 12], "opcod": [6, 12, 18], "implement": [6, 12], "list": 6, "math": [6, 12, 14], "comparison": [6, 12, 15], "logic": [6, 12, 16], "bit": [6, 12, 17], "op": [6, 12], "misc": [6, 12, 18], "ethereum": [6, 11, 12], "pop": [6, 12], "jump": [6, 12, 23], "push": [6, 8, 12], "dup": [6, 12], "swap": [6, 12], "contract": [6, 12], "bytecod": [8, 11], "simpl": 8, "instruct": 8, "data": [8, 19], "add": 8, "resourc": 10, "introduct": 11, "virut": 11, "machin": 11, "solid": 11, "vyper": 11, "huff": 11, "vs": [11, 18], "bitcoin": 11, "outlin": 11, "prerequisit": 11, "note": 11, "stop": 13, "less": 15, "than": 15, "sign": [15, 17], "greater": 15, "equal": 15, "Is": 15, "zero": 15, "And": 16, "Or": 16, "xor": 16, "Not": 16, "byte": 17, "shift": 17, "left": 17, "right": 17, "precompil": 18, "hash": [18, 19], "function": 18, "environ": 19, "address": 19, "balanc": 19, "origin": 19, "caller": 19, "callvalu": 19, "calldataload": 19, "calldatas": 19, "calldatacopi": 19, "codes": 19, "codecopi": 19, "price": 19, "extern": 19, "code": 19, "size": 19, "copi": 19, "return": 19, "block": 19, "coinbas": 19}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 6, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.intersphinx": 1, "sphinxcontrib.bibtex": 9, "sphinx": 56}}) \ No newline at end of file diff --git a/content/.ipynb_checkpoints/05_1_state-checkpoint.ipynb b/content/.ipynb_checkpoints/05_1_state-checkpoint.ipynb new file mode 100644 index 0000000..c6ae4f7 --- /dev/null +++ b/content/.ipynb_checkpoints/05_1_state-checkpoint.ipynb @@ -0,0 +1,258 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "973f8632", + "metadata": {}, + "source": [ + "# EVM State" + ] + }, + { + "cell_type": "markdown", + "id": "784a59d7", + "metadata": {}, + "source": [ + "The EVM is a state machine. A valid Ethereum program or valid bytecode can manipulate that state." + ] + }, + { + "cell_type": "markdown", + "id": "200c45d3", + "metadata": {}, + "source": [ + "A specific opcode is an operation that manipulates that state." + ] + }, + { + "cell_type": "markdown", + "id": "36a04101", + "metadata": {}, + "source": [ + "### Program Counter (pc)" + ] + }, + { + "cell_type": "markdown", + "id": "ce9fe248", + "metadata": {}, + "source": [ + "The program counter points to the next opcode that the EVM is going to execute." + ] + }, + { + "cell_type": "markdown", + "id": "8bd37067", + "metadata": {}, + "source": [ + "### Stack / Memory / Storage" + ] + }, + { + "cell_type": "markdown", + "id": "a8d57b1b", + "metadata": {}, + "source": [ + "All of them are part of the EVM state. And are the areas where the EVM manipulates and stores data." + ] + }, + { + "cell_type": "markdown", + "id": "19633bd5", + "metadata": {}, + "source": [ + "### Program" + ] + }, + { + "cell_type": "markdown", + "id": "05ec82bf", + "metadata": {}, + "source": [ + "This is where we store the bytecode of the current program. It can not change during execution, which makes it immutable." + ] + }, + { + "cell_type": "markdown", + "id": "9776396a", + "metadata": {}, + "source": [ + "### Sender" + ] + }, + { + "cell_type": "markdown", + "id": "eaac339b", + "metadata": {}, + "source": [ + "Address of the account currently executing this program. Equivalent to `msg.sender` in Solidity." + ] + }, + { + "cell_type": "markdown", + "id": "eea13249", + "metadata": {}, + "source": [ + "### Program" + ] + }, + { + "cell_type": "markdown", + "id": "5347aaca", + "metadata": {}, + "source": [ + "This is where we store the bytecode of the current program. It can not change during execution, which makes it immutable." + ] + }, + { + "cell_type": "markdown", + "id": "e07bf794", + "metadata": {}, + "source": [ + "### Gas" + ] + }, + { + "cell_type": "markdown", + "id": "6c61487c", + "metadata": {}, + "source": [ + "We need to keep track how much gas we currently have and how much we already consumed. Most opcodes make the gas counter go down." + ] + }, + { + "cell_type": "markdown", + "id": "8b45b305", + "metadata": {}, + "source": [ + "### Value" + ] + }, + { + "cell_type": "markdown", + "id": "a52bd4e8", + "metadata": {}, + "source": [ + "How much Ether (wei) this current execution can consume." + ] + }, + { + "cell_type": "markdown", + "id": "5abc90e8", + "metadata": {}, + "source": [ + "### Calldata" + ] + }, + { + "cell_type": "markdown", + "id": "0d427d61", + "metadata": {}, + "source": [ + "Is the input to our program." + ] + }, + { + "cell_type": "markdown", + "id": "85538f4f", + "metadata": {}, + "source": [ + "### Flags" + ] + }, + { + "cell_type": "markdown", + "id": "38d9e555", + "metadata": {}, + "source": [ + "We are going to keep track of two flags. The `stop_flag` and `revert_flag`. If one of them is `True` the current execution is going to stop." + ] + }, + { + "cell_type": "markdown", + "id": "446fb931", + "metadata": {}, + "source": [ + "### Returndata" + ] + }, + { + "cell_type": "markdown", + "id": "d39d4223", + "metadata": {}, + "source": [ + "The EVM can return data after execution. We store this data in `return`." + ] + }, + { + "cell_type": "markdown", + "id": "0f5076db", + "metadata": {}, + "source": [ + "### Logs" + ] + }, + { + "cell_type": "markdown", + "id": "e90bba27", + "metadata": {}, + "source": [ + "There are several opcodes that emit logs when executed. The result of these logs is saved here." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "ac69f3ea", + "metadata": {}, + "outputs": [], + "source": [ + "class State:\n", + " def __init__(self,\n", + " sender,\n", + " program,\n", + " gas,\n", + " value,\n", + " calldata=[]):\n", + " self.pc = 0\n", + " \n", + " self.stack = Stack()\n", + " self.memory = Memory()\n", + " self.storage = Storage()\n", + " \n", + " self.sender = sender\n", + " self.program = program\n", + " self.gas = gas\n", + " self.value = value\n", + " self.calldata = calldata\n", + " \n", + " self.stop_flag = False\n", + " self.revert_flag = False\n", + " \n", + " self.returndata = []\n", + " self.logs = []" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/05_1_state.ipynb b/content/05_1_state.ipynb index 8ad004a..c6ae4f7 100644 --- a/content/05_1_state.ipynb +++ b/content/05_1_state.ipynb @@ -72,6 +72,38 @@ "This is where we store the bytecode of the current program. It can not change during execution, which makes it immutable." ] }, + { + "cell_type": "markdown", + "id": "9776396a", + "metadata": {}, + "source": [ + "### Sender" + ] + }, + { + "cell_type": "markdown", + "id": "eaac339b", + "metadata": {}, + "source": [ + "Address of the account currently executing this program. Equivalent to `msg.sender` in Solidity." + ] + }, + { + "cell_type": "markdown", + "id": "eea13249", + "metadata": {}, + "source": [ + "### Program" + ] + }, + { + "cell_type": "markdown", + "id": "5347aaca", + "metadata": {}, + "source": [ + "This is where we store the bytecode of the current program. It can not change during execution, which makes it immutable." + ] + }, { "cell_type": "markdown", "id": "e07bf794", @@ -177,6 +209,7 @@ "source": [ "class State:\n", " def __init__(self,\n", + " sender,\n", " program,\n", " gas,\n", " value,\n", @@ -187,6 +220,7 @@ " self.memory = Memory()\n", " self.storage = Storage()\n", " \n", + " self.sender = sender\n", " self.program = program\n", " self.gas = gas\n", " self.value = value\n", diff --git a/content/opcodes/.ipynb_checkpoints/12_environment-checkpoint.ipynb b/content/opcodes/.ipynb_checkpoints/12_environment-checkpoint.ipynb new file mode 100644 index 0000000..fc01072 --- /dev/null +++ b/content/opcodes/.ipynb_checkpoints/12_environment-checkpoint.ipynb @@ -0,0 +1,615 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "03255559", + "metadata": {}, + "source": [ + "# Environment" + ] + }, + { + "cell_type": "markdown", + "id": "1fa2b79c", + "metadata": {}, + "source": [ + "These opcodes give you access to the Ethereum environment" + ] + }, + { + "cell_type": "markdown", + "id": "451ec894", + "metadata": {}, + "source": [ + "#### Address" + ] + }, + { + "cell_type": "markdown", + "id": "7383a227", + "metadata": {}, + "source": [ + "Returns the address of the account currently executing this program" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "e957a322", + "metadata": {}, + "outputs": [], + "source": [ + "def address(evm):\n", + " evm.stack.push(evm.sender)\n", + " evm.pc += 1\n", + " evm.gas_dec(3)" + ] + }, + { + "cell_type": "markdown", + "id": "c773cc1b", + "metadata": {}, + "source": [ + "#### Balance" + ] + }, + { + "cell_type": "markdown", + "id": "0ab650ee", + "metadata": {}, + "source": [ + "Get the balance of the given address. We only mock this, so we always return the same value for every address." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "2a4f4184", + "metadata": {}, + "outputs": [], + "source": [ + "def balance(evm):\n", + " address = cpu.stack.pop()\n", + " evm.stack.push(99999999999)\n", + "\n", + " evm.pc += 1\n", + " evm.gas_dec(2600) # 100 if warm" + ] + }, + { + "cell_type": "markdown", + "id": "e3d1f582", + "metadata": {}, + "source": [ + "#### Origin" + ] + }, + { + "cell_type": "markdown", + "id": "e05f87a0", + "metadata": {}, + "source": [ + "The address that originally triggered the execution. This is `tx.origin`in Solidity.\n", + "For us `tx.origin` is always equal to `msg.sender`. That is why we simply return the `sender`." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "184910fc", + "metadata": {}, + "outputs": [], + "source": [ + "def origin(evm):\n", + " evm.stack.push(evm.sender)\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "1420754f", + "metadata": {}, + "source": [ + "#### Caller" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "7e6253d7", + "metadata": {}, + "outputs": [], + "source": [ + "def caller(evm):\n", + " evm.stack.push(\"0x414b60745072088d013721b4a28a0559b1A9d213\")\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "8a5c3ddc", + "metadata": {}, + "source": [ + "#### Callvalue" + ] + }, + { + "cell_type": "markdown", + "id": "a4cb721d", + "metadata": {}, + "source": [ + "Returns the value of Ether (wei) provided for this execution" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "ed2ce73a", + "metadata": {}, + "outputs": [], + "source": [ + "def callvalue(evm):\n", + " evm.stack.push(evm.value)\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "10e433b9", + "metadata": {}, + "source": [ + "#### Calldataload" + ] + }, + { + "cell_type": "markdown", + "id": "3496b598", + "metadata": {}, + "source": [ + "Pushes the current input data (32 bytes) on the stack" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5e50b0a6", + "metadata": {}, + "outputs": [], + "source": [ + "def calldataload(evm):\n", + " i = evm.stack.pop()\n", + "\n", + " delta = 0\n", + " if i+32 > len(evm.calldata):\n", + " delta = i+32 - len(evm.calldata)\n", + "\n", + " # always has to be 32 bytes\n", + " # if its not we append 0x00 bytes until it is\n", + " calldata = evm.calldata[i:i+32-delta]\n", + " calldata += 0x00*delta\n", + "\n", + " evm.stack.push(calldata)\n", + " evm.pc += 1\n", + " evm.gas_dec(3)" + ] + }, + { + "cell_type": "markdown", + "id": "f51d42de", + "metadata": {}, + "source": [ + "#### Calldatasize" + ] + }, + { + "cell_type": "markdown", + "id": "12c11f18", + "metadata": {}, + "source": [ + "Pushes the size of the calldata on the stack" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "f113ad83", + "metadata": {}, + "outputs": [], + "source": [ + "def calldatasize(evm):\n", + " evm.stack.push(len(evm.calldata))\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "cc2b23e4", + "metadata": {}, + "source": [ + "#### Calldatacopy" + ] + }, + { + "cell_type": "markdown", + "id": "789093d8", + "metadata": {}, + "source": [ + "Stores a specified part of the calldata in memory" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "fad6dc1e", + "metadata": {}, + "outputs": [], + "source": [ + "def calldatacopy(evm):\n", + " destOffset = cpu.stack.pop()\n", + " offset = evm.stack.pop()\n", + " size = evm.stack.pop()\n", + "\n", + " calldata = evm.calldata[offset:offset+size]\n", + " memory_expansion_cost = evm.memory.store(destOffset, calldata)\n", + "\n", + " static_gas = 3\n", + " minimum_word_size = (size + 31) // 32\n", + " dynamic_gas = 3 * minimum_word_size + memory_expansion_cost\n", + "\n", + " evm.gas_dec(static_gas + dynamic_gas)\n", + " evm.pc += 1" + ] + }, + { + "cell_type": "markdown", + "id": "e4198cdc", + "metadata": {}, + "source": [ + "#### Codesize" + ] + }, + { + "cell_type": "markdown", + "id": "485b67e8", + "metadata": {}, + "source": [ + "Puts the size of the currently running program on the stack" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "3722d443", + "metadata": {}, + "outputs": [], + "source": [ + "def codesize(evm):\n", + " evm.stack.push(len(evm.program))\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "3ec39a93", + "metadata": {}, + "source": [ + "#### Codecopy" + ] + }, + { + "cell_type": "markdown", + "id": "59a7e30f", + "metadata": {}, + "source": [ + "Stores a specified part of the program in memory" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "9c145044", + "metadata": {}, + "outputs": [], + "source": [ + "def codecopy(evm):\n", + " destOffset = evm.stack.pop()\n", + " offset = evm.stack.pop()\n", + " size = evm.stack.pop()\n", + "\n", + " code = evm.program[offset:offset+size]\n", + " memory_expansion_cost = evm.memory.store(destOffset, code)\n", + "\n", + " static_gas = 3\n", + " minimum_word_size = (size + 31) / 32\n", + " dynamic_gas = 3 * minimum_word_size + memory_expansion_cost\n", + "\n", + " evm.gas_dec(static_gas + dynamic_gas)\n", + " evm.pc += 1" + ] + }, + { + "cell_type": "markdown", + "id": "6b2e5e49", + "metadata": {}, + "source": [ + "#### Gas Price" + ] + }, + { + "cell_type": "markdown", + "id": "eb7d2869", + "metadata": {}, + "source": [ + "The current gas price. Because we are running everything locally, the gas price is simply 0." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "f11fcf1b", + "metadata": {}, + "outputs": [], + "source": [ + "def gasprice(evm):\n", + " evm.stack.push(0x00)\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "bbf3852f", + "metadata": {}, + "source": [ + "#### External Code Size" + ] + }, + { + "cell_type": "markdown", + "id": "1c843271", + "metadata": {}, + "source": [ + "The size of another program given by its address. There are no other programs in our simplified world so we simply return 0." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "12b53b96", + "metadata": {}, + "outputs": [], + "source": [ + "def extcodesize(evm):\n", + " address = evm.stack.pop()\n", + " evm.stack.push(0x00)\n", + " evm.gas_dec(2600) # 100 if warm\n", + " evm.pc += 1" + ] + }, + { + "cell_type": "markdown", + "id": "5c234854", + "metadata": {}, + "source": [ + "#### External Code Copy" + ] + }, + { + "cell_type": "markdown", + "id": "4dcf5a4b", + "metadata": {}, + "source": [ + "Stores a specified part of another program in memory" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "934ca4f6", + "metadata": {}, + "outputs": [], + "source": [ + "def extcodecopy(evm):\n", + " address = evm.stack.pop()\n", + " destOffset = evm.stack.pop()\n", + " offset = evm.stack.pop()\n", + " size = evm.stack.pop()\n", + "\n", + " extcode = [] # no external code\n", + " memory_expansion_cost = evm.memory.store(destOffset, extcode)\n", + "\n", + " # refactor this in seperate method\n", + " minimum_word_size = (size + 31) / 32\n", + " dynamic_gas = 3 * minimum_word_size + memory_expansion_cost\n", + " address_access_cost = 100 if warm else 2600\n", + "\n", + " evm.gas_dec(dynamic_gas + address_access_cost)\n", + " evm.pc += 1" + ] + }, + { + "cell_type": "markdown", + "id": "93e06567", + "metadata": {}, + "source": [ + "#### Return Data Size" + ] + }, + { + "cell_type": "markdown", + "id": "c3c1f4f1", + "metadata": {}, + "source": [ + "Get size of output data from the previous call from the current environment. As our execution is the only one running, there is no previous return data. Therefore we can simply return 0." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "f9dce9b3", + "metadata": {}, + "outputs": [], + "source": [ + "def returndatasize(evm):\n", + " evm.stack.push(0x00) # no return data\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + }, + { + "cell_type": "markdown", + "id": "af214873", + "metadata": {}, + "source": [ + "#### Return Data Copy" + ] + }, + { + "cell_type": "markdown", + "id": "e5bcbf77", + "metadata": {}, + "source": [ + "Stores a specified part of the previous return data in memory" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "ec3f21e0", + "metadata": {}, + "outputs": [], + "source": [ + "def returndatacopy(evm):\n", + " destOffset = evm.stack.pop()\n", + " offset = evm.stack.pop()\n", + " size = evm.stack.pop()\n", + "\n", + " returndata = evm.program[offset:offset+size]\n", + " memory_expansion_cost = evm.memory.store(destOffset, returndata)\n", + "\n", + " minimum_word_size = (size + 31) / 32\n", + " dynamic_gas = 3 * minimum_word_size + memory_expansion_cost\n", + "\n", + " evm.gas_dec(3 + dynamic_gas)\n", + " evm.pc += 1" + ] + }, + { + "cell_type": "markdown", + "id": "429ca19e", + "metadata": {}, + "source": [ + "#### External Code Hash" + ] + }, + { + "cell_type": "markdown", + "id": "55cfd8d2", + "metadata": {}, + "source": [ + "The hash of another program given by its address. There are no other programs in our simplified world so we simply return 0." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0501762f", + "metadata": {}, + "outputs": [], + "source": [ + "def extcodehash(evm):\n", + " address = evm.stack.pop()\n", + " evm.stack.push(0x00) # no code\n", + "\n", + " evm.gas_dec(2600) # 100 if warm\n", + " evm.pc += 1" + ] + }, + { + "cell_type": "markdown", + "id": "8ccb0b87", + "metadata": {}, + "source": [ + "#### Block Hash" + ] + }, + { + "cell_type": "markdown", + "id": "ccef2d60", + "metadata": {}, + "source": [ + "Get the hash of one of the 256 most recent complete blocks and push it on the stack." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a8bc2485", + "metadata": {}, + "outputs": [], + "source": [ + "def blockhash(evm):\n", + " blockNumber = evm.stack.pop()\n", + " if blockNumber > 256: raise Exception(\"Only last 256 blocks can be accessed\")\n", + " evm.stack.push(0x1cbcfa1ffb1ca1ca8397d4f490194db5fc0543089b9dee43f76cf3f962a185e8)\n", + " evm.pc += 1\n", + " evm.gas_dec(20)" + ] + }, + { + "cell_type": "markdown", + "id": "94fd73fd", + "metadata": {}, + "source": [ + "#### Coinbase" + ] + }, + { + "cell_type": "markdown", + "id": "03642f33", + "metadata": {}, + "source": [ + "Get the address of the miner for this block" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7808257e", + "metadata": {}, + "outputs": [], + "source": [ + "def coinbase(evm):\n", + " evm.stack.push(0x1cbcfa1ffb1ca1ca8397d4f490194db5fc0543089b9dee43f76cf3f962a185e8)\n", + " evm.pc += 1\n", + " evm.gas_dec(2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/opcodes/12_environment.ipynb b/content/opcodes/12_environment.ipynb index ca575e3..fc01072 100644 --- a/content/opcodes/12_environment.ipynb +++ b/content/opcodes/12_environment.ipynb @@ -24,6 +24,14 @@ "#### Address" ] }, + { + "cell_type": "markdown", + "id": "7383a227", + "metadata": {}, + "source": [ + "Returns the address of the account currently executing this program" + ] + }, { "cell_type": "code", "execution_count": 1, @@ -32,7 +40,7 @@ "outputs": [], "source": [ "def address(evm):\n", - " evm.stack.push(\"0x414b60745072088d013721b4a28a0559b1A9d213\")\n", + " evm.stack.push(evm.sender)\n", " evm.pc += 1\n", " evm.gas_dec(3)" ] @@ -45,6 +53,14 @@ "#### Balance" ] }, + { + "cell_type": "markdown", + "id": "0ab650ee", + "metadata": {}, + "source": [ + "Get the balance of the given address. We only mock this, so we always return the same value for every address." + ] + }, { "cell_type": "code", "execution_count": 3, @@ -68,15 +84,24 @@ "#### Origin" ] }, + { + "cell_type": "markdown", + "id": "e05f87a0", + "metadata": {}, + "source": [ + "The address that originally triggered the execution. This is `tx.origin`in Solidity.\n", + "For us `tx.origin` is always equal to `msg.sender`. That is why we simply return the `sender`." + ] + }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "id": "184910fc", "metadata": {}, "outputs": [], "source": [ "def origin(evm):\n", - " evm.stack.push(\"0x414b60745072088d013721b4a28a0559b1A9d213\")\n", + " evm.stack.push(evm.sender)\n", " evm.pc += 1\n", " evm.gas_dec(2)" ] @@ -110,9 +135,17 @@ "#### Callvalue" ] }, + { + "cell_type": "markdown", + "id": "a4cb721d", + "metadata": {}, + "source": [ + "Returns the value of Ether (wei) provided for this execution" + ] + }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "id": "ed2ce73a", "metadata": {}, "outputs": [], @@ -131,6 +164,14 @@ "#### Calldataload" ] }, + { + "cell_type": "markdown", + "id": "3496b598", + "metadata": {}, + "source": [ + "Pushes the current input data (32 bytes) on the stack" + ] + }, { "cell_type": "code", "execution_count": null, @@ -163,6 +204,14 @@ "#### Calldatasize" ] }, + { + "cell_type": "markdown", + "id": "12c11f18", + "metadata": {}, + "source": [ + "Pushes the size of the calldata on the stack" + ] + }, { "cell_type": "code", "execution_count": 7, @@ -184,6 +233,14 @@ "#### Calldatacopy" ] }, + { + "cell_type": "markdown", + "id": "789093d8", + "metadata": {}, + "source": [ + "Stores a specified part of the calldata in memory" + ] + }, { "cell_type": "code", "execution_count": 8, @@ -215,6 +272,14 @@ "#### Codesize" ] }, + { + "cell_type": "markdown", + "id": "485b67e8", + "metadata": {}, + "source": [ + "Puts the size of the currently running program on the stack" + ] + }, { "cell_type": "code", "execution_count": 9, @@ -236,6 +301,14 @@ "#### Codecopy" ] }, + { + "cell_type": "markdown", + "id": "59a7e30f", + "metadata": {}, + "source": [ + "Stores a specified part of the program in memory" + ] + }, { "cell_type": "code", "execution_count": 10, @@ -267,6 +340,14 @@ "#### Gas Price" ] }, + { + "cell_type": "markdown", + "id": "eb7d2869", + "metadata": {}, + "source": [ + "The current gas price. Because we are running everything locally, the gas price is simply 0." + ] + }, { "cell_type": "code", "execution_count": 11, @@ -288,6 +369,14 @@ "#### External Code Size" ] }, + { + "cell_type": "markdown", + "id": "1c843271", + "metadata": {}, + "source": [ + "The size of another program given by its address. There are no other programs in our simplified world so we simply return 0." + ] + }, { "cell_type": "code", "execution_count": 12, @@ -310,6 +399,14 @@ "#### External Code Copy" ] }, + { + "cell_type": "markdown", + "id": "4dcf5a4b", + "metadata": {}, + "source": [ + "Stores a specified part of another program in memory" + ] + }, { "cell_type": "code", "execution_count": 13, @@ -343,6 +440,14 @@ "#### Return Data Size" ] }, + { + "cell_type": "markdown", + "id": "c3c1f4f1", + "metadata": {}, + "source": [ + "Get size of output data from the previous call from the current environment. As our execution is the only one running, there is no previous return data. Therefore we can simply return 0." + ] + }, { "cell_type": "code", "execution_count": 14, @@ -364,6 +469,14 @@ "#### Return Data Copy" ] }, + { + "cell_type": "markdown", + "id": "e5bcbf77", + "metadata": {}, + "source": [ + "Stores a specified part of the previous return data in memory" + ] + }, { "cell_type": "code", "execution_count": 15, @@ -394,6 +507,14 @@ "#### External Code Hash" ] }, + { + "cell_type": "markdown", + "id": "55cfd8d2", + "metadata": {}, + "source": [ + "The hash of another program given by its address. There are no other programs in our simplified world so we simply return 0." + ] + }, { "cell_type": "code", "execution_count": null, @@ -417,6 +538,14 @@ "#### Block Hash" ] }, + { + "cell_type": "markdown", + "id": "ccef2d60", + "metadata": {}, + "source": [ + "Get the hash of one of the 256 most recent complete blocks and push it on the stack." + ] + }, { "cell_type": "code", "execution_count": null, @@ -440,6 +569,14 @@ "#### Coinbase" ] }, + { + "cell_type": "markdown", + "id": "03642f33", + "metadata": {}, + "source": [ + "Get the address of the miner for this block" + ] + }, { "cell_type": "code", "execution_count": null,