import * as OpStep from '@tevm/primitives/OpStep';
// Basic OpStep
const step = OpStep.from({
pc: 0,
op: 0x60, // PUSH1
gas: 1000000n,
gasCost: 3n,
depth: 0,
});
// OpStep with stack
const addStep = OpStep.from({
pc: 2,
op: 0x01, // ADD
gas: 999997n,
gasCost: 3n,
depth: 0,
stack: [5n, 10n], // Top of stack first
});
// OpStep with memory
const mstoreStep = OpStep.from({
pc: 10,
op: 0x52, // MSTORE
gas: 999900n,
gasCost: 6n,
depth: 0,
memory: new Uint8Array([0x60, 0x40]),
});
// OpStep with storage
const sstoreStep = OpStep.from({
pc: 20,
op: 0x55, // SSTORE
gas: 980000n,
gasCost: 20000n,
depth: 0,
storage: { "0x01": 100n },
});
// OpStep with error
const revertStep = OpStep.from({
pc: 100,
op: 0xfd, // REVERT
gas: 50000n,
gasCost: 0n,
depth: 0,
error: "execution reverted",
});