mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/tracers/js: fix isPush for push0
This commit is contained in:
parent
f265cc24b4
commit
50c8e8c7bc
2 changed files with 19 additions and 1 deletions
|
|
@ -55,6 +55,24 @@ func TestInstructionIteratorInvalid(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// Tests disassembling the instructions for PUSH0
|
||||
func TestInstructionIteratorPUSH0(t *testing.T) {
|
||||
cnt := 0
|
||||
script, _ := hex.DecodeString("5900")
|
||||
|
||||
it := NewInstructionIterator(script)
|
||||
for it.Next() {
|
||||
cnt++
|
||||
}
|
||||
|
||||
if err := it.Error(); err != nil {
|
||||
t.Errorf("Expected 2, but encountered error %v instead.", err)
|
||||
}
|
||||
if cnt != 2 {
|
||||
t.Errorf("Expected 2, but got %v instead.", cnt)
|
||||
}
|
||||
}
|
||||
|
||||
// Tests disassembling the instructions for empty evm code
|
||||
func TestInstructionIteratorEmpty(t *testing.T) {
|
||||
cnt := 0
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ type OpCode byte
|
|||
|
||||
// IsPush specifies if an opcode is a PUSH opcode.
|
||||
func (op OpCode) IsPush() bool {
|
||||
return PUSH1 <= op && op <= PUSH32
|
||||
return PUSH0 <= op && op <= PUSH32
|
||||
}
|
||||
|
||||
// 0x0 range - arithmetic ops.
|
||||
|
|
|
|||
Loading…
Reference in a new issue