%%capture
%run 05_opcodes.ipynb
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/core/magics/execution.py:727, in ExecutionMagics.run(self, parameter_s, runner, file_finder)
726 fpath = arg_lst[0]
--> 727 filename = file_finder(fpath)
728 except IndexError as e:
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/utils/path.py:90, in get_py_filename(name)
89 return py_name
---> 90 raise IOError("File `%r` not found." % name)
OSError: File `'05_opcodes.ipynb'` not found.
The above exception was the direct cause of the following exception:
Exception Traceback (most recent call last)
Cell In[1], line 1
----> 1 get_ipython().run_line_magic('run', '05_opcodes.ipynb')
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/core/interactiveshell.py:2486, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
2484 kwargs['local_ns'] = self.get_local_scope(stack_depth)
2485 with self.builtin_trap:
-> 2486 result = fn(*args, **kwargs)
2488 # The code below prevents the output from being displayed
2489 # when using magics with decorator @output_can_be_silenced
2490 # when the last Python token in the expression is a ';'.
2491 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/core/magics/execution.py:738, in ExecutionMagics.run(self, parameter_s, runner, file_finder)
736 if os.name == 'nt' and re.match(r"^'.*'$",fpath):
737 warn('For Windows, use double quotes to wrap a filename: %run "mypath\\myfile.py"')
--> 738 raise Exception(msg) from e
739 except TypeError:
740 if fpath in sys.meta_path:
Exception: File `'05_opcodes.ipynb'` not found.
---------------------------------------------------------------------------
TokenError Traceback (most recent call last)
Cell In[1], line 1
----> 1 get_ipython().run_cell_magic('capture', '', '%run 05_opcodes.ipynb\n')
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/core/interactiveshell.py:2547, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
2545 with self.builtin_trap:
2546 args = (magic_arg_s, cell)
-> 2547 result = fn(*args, **kwargs)
2549 # The code below prevents the output from being displayed
2550 # when using magics with decorator @output_can_be_silenced
2551 # when the last Python token in the expression is a ';'.
2552 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/core/magics/execution.py:1549, in ExecutionMagics.capture(self, line, cell)
1547 with capture_output(out, err, disp) as io:
1548 self.shell.run_cell(cell)
-> 1549 if DisplayHook.semicolon_at_end_of_expression(cell):
1550 if args.output in self.shell.user_ns:
1551 del self.shell.user_ns[args.output]
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/site-packages/IPython/core/displayhook.py:104, in DisplayHook.semicolon_at_end_of_expression(expression)
101 """Parse Python expression and detects whether last token is ';'"""
103 sio = _io.StringIO(expression)
--> 104 tokens = list(tokenize.generate_tokens(sio.readline))
106 for token in reversed(tokens):
107 if token[0] in (tokenize.ENDMARKER, tokenize.NL, tokenize.NEWLINE, tokenize.COMMENT):
File ~/.local/share/mise/installs/python/3.13.3/lib/python3.13/tokenize.py:588, in _generate_tokens_from_c_tokenizer(source, encoding, extra_tokens)
586 raise e from None
587 msg = _transform_msg(e.msg)
--> 588 raise TokenError(msg, (e.lineno, e.offset)) from None
TokenError: ('invalid decimal literal', (1, 8))
Jump#
def jump(evm):
counter = evm.stack.pop()
# make sure that we jump to an JUMPDEST opcode
if not evm.program[counter] == JUMPDEST:
raise Exception("Can only jump to JUMPDEST")
evm.pc = counter
evm.gas_dec(8)
def jumpi(evm):
counter, b = evm.stack.pop(), evm.stack.pop()
if b != 0: evm.pc = counter
else : evm.pc += 1
evm.gas_dec(10)
def pc(evm):
evm.stack.push(cpu.pc)
evm.pc += 1
evm.gas_dec(2)
def jumpdest(evm):
evm.pc += 1
evm.gas_dec(1)