shafu0x / evm-from-scratch-book

The EVM from scratch book
https://evm-from-scratch.xyz
70 stars 14 forks source link

Code typos on content/07a_opcodes/02_math.ipynb #18

Open 0x6980 opened 4 weeks ago

0x6980 commented 4 weeks ago

In the function mulmod(evm)

def mulmod(evm):
    a, b = evm.stack.pop(), evm.stack.pop()
    N = evm.stack.pop()
    evm.stack.push((a + b) * N)
    evm.pc += 1
    evm.gas_dec(8)

this part evm.stack.push((a + b) * N) should be evm.stack.push((a * b) % N)

shafu0x commented 4 weeks ago

you are right, could you do a PR?