Skip to content

Commit 0cc5437

Browse files
committed
fix: small fixes
1 parent f08bf84 commit 0cc5437

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

json/decode_log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func DecodeLog(topics [][]byte, input []byte, event eth_abi.Event) (ast.Node, er
1212

1313
// mismatch btw num of indexed fields and num of topics
1414
if len(indexed) != (len(topics) - 1) {
15-
return ast.Node{}, fmt.Errorf("event has %d indexed inputs but log has %d topics", len(indexed), (len(topics) - 1))
15+
return ast.Node{}, fmt.Errorf("event has %d indexed inputs but log has %d topics", len(indexed), len(topics))
1616
}
1717

1818
// log has data but abi field does not have unindexed fields

json/decode_trace.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import (
88
)
99

1010
func DecodeTrace(input []byte, output []byte, method eth_abi.Method) (ast.Node, error) {
11+
if len(input) < 4 {
12+
return ast.Node{}, fmt.Errorf("trace input is smaller than 4 bytes")
13+
}
14+
1115
if len(method.Outputs) == 0 && len(output) > 0 {
1216
return ast.Node{}, fmt.Errorf("trace has output data but method has no outputs")
1317
}

0 commit comments

Comments
 (0)