Skip to content

Instantly share code, notes, and snippets.

@mratsim
Created June 15, 2018 19:05
Show Gist options
  • Save mratsim/34479da563108ca04f9003795da70029 to your computer and use it in GitHub Desktop.
Save mratsim/34479da563108ca04f9003795da70029 to your computer and use it in GitHub Desktop.
EVM opcode refactor test
import
stint,
../nimbus/constants,
../nimbus/vm/interpreter/[opcodes_impl, vm_forks],
../nimbus/vm/[message, computation, stack],
../nimbus/utils/header,
../nimbus/db/[db_chain, state_db, backends/memory_backend]
let msg = newMessage(
to=ZERO_ADDRESS, #fixture{"exec"}{"address"}.getStr,
sender=ZERO_ADDRESS, #fixture{"exec"}{"caller"}.getStr,
value=0.u256,
data = @[],
code="0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01",
gas=100_000,
gasPrice=1)
let h = BlockHeader(blockNumber: 100.u256)
var vm = newNimbusVM(h, newBaseChainDB(newMemoryDB()))
var c = newBaseComputation(vm.state, msg)
echo c.stack.values
c.stack = newStack()
c.stack.push 10.u256
c.stack.push 20.u256
echo "\n"
echo c.stack.values
addFkFrontier(c)
echo "\n"
echo c.stack.values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment