Skip to content

Commit

Permalink
format and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cassc committed Nov 30, 2023
1 parent 4e83444 commit 7deee0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,19 @@ Options:
``` bash
❯ evm-interpreter execute --bytecode 604260005260206000F3 --pprint
Input: Bytes(0x)
Output: Bytes(0x0000000000000000000000000000000000000000000000000000000000000042)
➡️ PC: 0 OPCODE: 0x60 PUSH1
➡️ PC: 0 OPCODE: 0x60 PUSH1 GAS_USED: 0 GAS_MEMORY: 0
STACK: []
➡️ PC: 2 OPCODE: 0x60 PUSH1
➡️ PC: 2 OPCODE: 0x60 PUSH1 GAS_USED: 3 GAS_MEMORY: 0
STACK: [66]
➡️ PC: 4 OPCODE: 0x52 MSTORE
➡️ PC: 4 OPCODE: 0x52 MSTORE GAS_USED: 6 GAS_MEMORY: 0
STACK: [66, 0]
➡️ PC: 5 OPCODE: 0x60 PUSH1
➡️ PC: 5 OPCODE: 0x60 PUSH1 GAS_USED: 12 GAS_MEMORY: 3
STACK: []
➡️ PC: 7 OPCODE: 0x60 PUSH1
➡️ PC: 7 OPCODE: 0x60 PUSH1 GAS_USED: 15 GAS_MEMORY: 3
STACK: [32]
➡️ PC: 9 OPCODE: 0xf3 RETURN
➡️ PC: 9 OPCODE: 0xf3 RETURN GAS_USED: 18 GAS_MEMORY: 3
STACK: [32, 0]
✅ OUTPUT: 0x0000000000000000000000000000000000000000000000000000000000000042
ID: 604260 ✅ OUTPUT: 0x0000000000000000000000000000000000000000000000000000000000000042
```

### Call contract with input
Expand Down
2 changes: 1 addition & 1 deletion src/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Trace {
pub fn pprint(&self) {
let readable_opcode = OPCODE_JUMPMAP.get(self.opcode as usize).unwrap().unwrap();
println!(
"➡️ PC: {:<5} OPCODE: 0x{:02x} {} GAS_USED: {}, GAS_MEMORY: {}",
"➡️ PC: {:<5} OPCODE: 0x{:02x} {:<8} GAS_USED: {:<12} GAS_MEMORY: {:<8}",
self.pc, self.opcode, readable_opcode, self.gas.used, self.gas.memory
);
println!(" STACK: {}", self.stack);
Expand Down

0 comments on commit 7deee0b

Please sign in to comment.