Commit 6bc18583 authored by 袁兴强's avatar 袁兴强 Committed by vipwzw

fix wasm bug

parent ab89972d
...@@ -130,7 +130,7 @@ func (w *Wasm) Exec_Call(payload *types2.WasmCall, tx *types.Transaction, index ...@@ -130,7 +130,7 @@ func (w *Wasm) Exec_Call(payload *types2.WasmCall, tx *types.Transaction, index
logs = append(logs, &types.ReceiptLog{Ty: types2.TyLogWasmCall, Log: types.Encode(&types2.CallContractLog{ logs = append(logs, &types.ReceiptLog{Ty: types2.TyLogWasmCall, Log: types.Encode(&types2.CallContractLog{
Contract: payload.Contract, Contract: payload.Contract,
Method: payload.Method, Method: payload.Method,
Result: ret, Result: int32(ret),
})}) })})
logs = append(logs, w.receiptLogs...) logs = append(logs, w.receiptLogs...)
logs = append(logs, &types.ReceiptLog{Ty: types2.TyLogCustom, Log: types.Encode(&types2.CustomLog{ logs = append(logs, &types.ReceiptLog{Ty: types2.TyLogCustom, Log: types.Encode(&types2.CustomLog{
...@@ -148,7 +148,7 @@ func (w *Wasm) Exec_Call(payload *types2.WasmCall, tx *types.Transaction, index ...@@ -148,7 +148,7 @@ func (w *Wasm) Exec_Call(payload *types2.WasmCall, tx *types.Transaction, index
KV: kvs, KV: kvs,
Logs: logs, Logs: logs,
} }
if ret < 0 { if int32(ret) < 0 || int16(ret) < 0 {
receipt.Ty = types.ExecPack receipt.Ty = types.ExecPack
} }
......
...@@ -37,7 +37,7 @@ message createContractLog { ...@@ -37,7 +37,7 @@ message createContractLog {
message callContractLog { message callContractLog {
string contract = 1; string contract = 1;
string method = 2; string method = 2;
int64 result = 3; int32 result = 3;
} }
message localDataLog { message localDataLog {
......
...@@ -5,9 +5,8 @@ package types ...@@ -5,9 +5,8 @@ package types
import ( import (
fmt "fmt" fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
math "math"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
...@@ -339,7 +338,7 @@ func (m *CreateContractLog) GetCode() string { ...@@ -339,7 +338,7 @@ func (m *CreateContractLog) GetCode() string {
type CallContractLog struct { type CallContractLog struct {
Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"`
Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
Result int64 `protobuf:"varint,3,opt,name=result,proto3" json:"result,omitempty"` Result int32 `protobuf:"varint,3,opt,name=result,proto3" json:"result,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -384,7 +383,7 @@ func (m *CallContractLog) GetMethod() string { ...@@ -384,7 +383,7 @@ func (m *CallContractLog) GetMethod() string {
return "" return ""
} }
func (m *CallContractLog) GetResult() int64 { func (m *CallContractLog) GetResult() int32 {
if m != nil { if m != nil {
return m.Result return m.Result
} }
...@@ -449,31 +448,29 @@ func init() { ...@@ -449,31 +448,29 @@ func init() {
proto.RegisterType((*LocalDataLog)(nil), "types.localDataLog") proto.RegisterType((*LocalDataLog)(nil), "types.localDataLog")
} }
func init() { func init() { proto.RegisterFile("wasm.proto", fileDescriptor_7d78909ad64e3bbb) }
proto.RegisterFile("wasm.proto", fileDescriptor_7d78909ad64e3bbb)
}
var fileDescriptor_7d78909ad64e3bbb = []byte{ var fileDescriptor_7d78909ad64e3bbb = []byte{
// 328 bytes of a gzipped FileDescriptorProto // 327 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x31, 0x4f, 0xc3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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 0x7d, 0x0c, 0x64, 0xab, 0x1a, 0x2f, 0x3b, 0xe6, 0x2e, 0xa4, 0x27, 0x8f, 0x1c, 0xb9, 0xd5, 0x3e, 0x86, 0x78, 0x2b, 0x5b, 0x27, 0x3b, 0x66, 0x36, 0x24, 0x27, 0xe1,
0xe1, 0x4e, 0x61, 0xfb, 0x6d, 0xf2, 0x1a, 0xfb, 0xbf, 0xe7, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x61, 0xfb, 0x3e, 0x79, 0x4d, 0xdc, 0xdf, 0x73, 0xfd, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xc3,
0x24, 0x00, 0xa4, 0xe6, 0x4b, 0x02, 0x00, 0x00, 0xc2, 0x9e, 0xbb, 0x4b, 0x02, 0x00, 0x00,
} }
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