新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Commit 596c52a4 authored by Devin Zeng's avatar Devin Zeng :alien:

fix: Evm abi don't support bytes hex string

--story=1011659
No related merge requests found
......@@ -2,6 +2,7 @@ package abi
import (
"encoding/binary"
"encoding/hex"
"fmt"
"math/big"
"reflect"
......@@ -613,12 +614,19 @@ func (e EVMBytes) getGoType() interface{} {
return &v
}
var reghex = regexp.MustCompile("0[xX][0-9a-fA-F]+")
func (e EVMBytes) pack(v interface{}) ([]byte, error) {
b, ok := v.([]byte)
if !ok {
s, ok := v.(string)
if ok {
b = []byte(s)
//如果是16进制,则进行转换
if reghex.MatchString(s) {
b, _ = hex.DecodeString(s[2:])
} else {
b = []byte(s)
}
} else {
return nil, fmt.Errorf("cannot map from %s to EVM bytes", reflect.ValueOf(v).Kind().String())
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment