From 7deee0bf9d31cc205509fe450cf3f866a0f91e22 Mon Sep 17 00:00:00 2001 From: Chen Date: Thu, 30 Nov 2023 12:05:09 +0800 Subject: [PATCH] format and update readme --- README.md | 15 +++++++-------- src/inspector.rs | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8643b63..f3af887 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/inspector.rs b/src/inspector.rs index 192bd8c..6e016c9 100644 --- a/src/inspector.rs +++ b/src/inspector.rs @@ -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);