Commit a4b37c31 authored by 袁兴强's avatar 袁兴强

wasm contract can be updated by the creator

parent a980fd5d
...@@ -23,6 +23,7 @@ func Cmd() *cobra.Command { ...@@ -23,6 +23,7 @@ func Cmd() *cobra.Command {
cmd.AddCommand( cmd.AddCommand(
cmdCheckContract(), cmdCheckContract(),
cmdCreateContract(), cmdCreateContract(),
cmdUpdateContract(),
cmdCallContract(), cmdCallContract(),
) )
...@@ -53,6 +54,19 @@ func cmdCreateContract() *cobra.Command { ...@@ -53,6 +54,19 @@ func cmdCreateContract() *cobra.Command {
return cmd return cmd
} }
func cmdUpdateContract() *cobra.Command {
cmd := &cobra.Command{
Use: "update",
Short: "update an existing contract on chain33",
Run: updateContract,
}
cmd.Flags().StringP("name", "n", "", "contract name")
cmd.Flags().StringP("path", "p", "", "path of the wasm file, such as ./test.wasm")
_ = cmd.MarkFlagRequired("name")
_ = cmd.MarkFlagRequired("path")
return cmd
}
func cmdCallContract() *cobra.Command { func cmdCallContract() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "call", Use: "call",
...@@ -110,6 +124,31 @@ func createContract(cmd *cobra.Command, args []string) { ...@@ -110,6 +124,31 @@ func createContract(cmd *cobra.Command, args []string) {
ctx.RunWithoutMarshal() ctx.RunWithoutMarshal()
} }
func updateContract(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
name, _ := cmd.Flags().GetString("name")
path, _ := cmd.Flags().GetString("path")
// Read WebAssembly *.wasm file.
code, err := ioutil.ReadFile(path)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
payload := wasmtypes.WasmUpdate{
Name: name,
Code: code,
}
params := rpctypes.CreateTxIn{
Execer: wasmtypes.WasmX,
ActionName: "Update",
Payload: types.MustPBToJSON(&payload),
}
ctx := jsonclient.NewRPCCtx(rpcLaddr, "Chain33.CreateTransaction", params, nil)
ctx.RunWithoutMarshal()
}
func callContract(cmd *cobra.Command, args []string) { func callContract(cmd *cobra.Command, args []string) {
rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr") rpcLaddr, _ := cmd.Flags().GetString("rpc_laddr")
name, _ := cmd.Flags().GetString("name") name, _ := cmd.Flags().GetString("name")
......
...@@ -55,9 +55,16 @@ wabt/bin/wasm2wat dice.wasm ...@@ -55,9 +55,16 @@ wabt/bin/wasm2wat dice.wasm
### 发布合约 ### 发布合约
```bash ```bash
# 若合约已存在则会创建失败,可以换一个合约名发布
./chain33-cli send wasm create -n 指定合约名 -p wasm合约路径 -k 用户私钥 ./chain33-cli send wasm create -n 指定合约名 -p wasm合约路径 -k 用户私钥
``` ```
### 更新合约
```bash
# 更新合约要求合约已存在,且只有合约创建者有更新权限
./chain33-cli send wasm update -n 指定合约名 -p wasm合约路径 -k 用户私钥
```
### 调用合约 ### 调用合约
```bash ```bash
#其中参数为用逗号分隔的数字列表,字符串参数为逗号分隔的字符串列表 #其中参数为用逗号分隔的数字列表,字符串参数为逗号分隔的字符串列表
......
...@@ -10,6 +10,11 @@ func contractKey(name string) []byte { ...@@ -10,6 +10,11 @@ func contractKey(name string) []byte {
return append([]byte("mavl-"+types2.WasmX+"-code-"), []byte(name)...) return append([]byte("mavl-"+types2.WasmX+"-code-"), []byte(name)...)
} }
// "mavl-wasm-creator-{name}"
func contractCreatorKey(name string) []byte {
return append([]byte("mavl-"+types2.WasmX+"-creator-"), []byte(name)...)
}
// "mavl-wasm-{contract}-" // "mavl-wasm-{contract}-"
func calcStatePrefix(contract string) []byte { func calcStatePrefix(contract string) []byte {
var prefix []byte var prefix []byte
......
...@@ -48,7 +48,7 @@ func (w *Wasm) Exec_Create(payload *types2.WasmCreate, tx *types.Transaction, in ...@@ -48,7 +48,7 @@ func (w *Wasm) Exec_Create(payload *types2.WasmCreate, tx *types.Transaction, in
return nil, types2.ErrInvalidWasm return nil, types2.ErrInvalidWasm
} }
kvc := dapp.NewKVCreator(w.GetStateDB(), nil, nil) kvc := dapp.NewKVCreator(w.GetStateDB(), types.CalcStatePrefix(tx.Execer), nil)
_, err := kvc.GetNoPrefix(contractKey(name)) _, err := kvc.GetNoPrefix(contractKey(name))
if err == nil { if err == nil {
return nil, types2.ErrContractExist return nil, types2.ErrContractExist
...@@ -57,6 +57,7 @@ func (w *Wasm) Exec_Create(payload *types2.WasmCreate, tx *types.Transaction, in ...@@ -57,6 +57,7 @@ func (w *Wasm) Exec_Create(payload *types2.WasmCreate, tx *types.Transaction, in
return nil, err return nil, err
} }
kvc.AddNoPrefix(contractKey(name), code) kvc.AddNoPrefix(contractKey(name), code)
kvc.AddNoPrefix(contractCreatorKey(name), []byte(tx.From()))
receiptLog := &types.ReceiptLog{ receiptLog := &types.ReceiptLog{
Ty: types2.TyLogWasmCreate, Ty: types2.TyLogWasmCreate,
...@@ -73,6 +74,53 @@ func (w *Wasm) Exec_Create(payload *types2.WasmCreate, tx *types.Transaction, in ...@@ -73,6 +74,53 @@ func (w *Wasm) Exec_Create(payload *types2.WasmCreate, tx *types.Transaction, in
}, nil }, nil
} }
func (w *Wasm) Exec_Update(payload *types2.WasmUpdate, tx *types.Transaction, index int) (*types.Receipt, error) {
if payload == nil {
return nil, types.ErrInvalidParam
}
if !w.checkTxExec(string(tx.Execer), types2.WasmX) {
return nil, types.ErrExecNameNotMatch
}
name := payload.Name
kvc := dapp.NewKVCreator(w.GetStateDB(), types.CalcStatePrefix(tx.Execer), nil)
creator, err := kvc.GetNoPrefix(contractCreatorKey(name))
if err != nil {
return nil, types2.ErrContractNotExist
}
_, err = kvc.GetNoPrefix(contractKey(name))
if err != nil {
return nil, types2.ErrContractNotExist
}
if tx.From() != string(creator) {
return nil, types2.ErrInvalidCreator
}
code := payload.Code
if len(code) > types2.MaxCodeSize {
return nil, types2.ErrCodeOversize
}
if err := validation.ValidateWasm(code); err != nil {
return nil, types2.ErrInvalidWasm
}
kvc.AddNoPrefix(contractKey(name), code)
receiptLog := &types.ReceiptLog{
Ty: types2.TyLogWasmUpdate,
Log: types.Encode(&types2.UpdateContractLog{
Name: name,
Code: hex.EncodeToString(code),
}),
}
return &types.Receipt{
Ty: types.ExecOk,
KV: kvc.KVList(),
Logs: []*types.ReceiptLog{receiptLog},
}, nil
}
func (w *Wasm) Exec_Call(payload *types2.WasmCall, tx *types.Transaction, index int) (*types.Receipt, error) { func (w *Wasm) Exec_Call(payload *types2.WasmCall, tx *types.Transaction, index int) (*types.Receipt, error) {
if payload == nil { if payload == nil {
return nil, types.ErrInvalidParam return nil, types.ErrInvalidParam
......
...@@ -9,6 +9,10 @@ func (w *Wasm) ExecDelLocal_Create(payload *types2.WasmCreate, tx *types.Transac ...@@ -9,6 +9,10 @@ func (w *Wasm) ExecDelLocal_Create(payload *types2.WasmCreate, tx *types.Transac
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
func (w *Wasm) ExecDelLocal_Update(payload *types2.WasmUpdate, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return &types.LocalDBSet{}, nil
}
func (w *Wasm) ExecDelLocal_Call(payload *types2.WasmCall, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (w *Wasm) ExecDelLocal_Call(payload *types2.WasmCall, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
localExecer := w.userExecName(payload.Contract, true) localExecer := w.userExecName(payload.Contract, true)
kvs, err := w.DelRollbackKV(tx, []byte(localExecer)) kvs, err := w.DelRollbackKV(tx, []byte(localExecer))
......
...@@ -9,6 +9,10 @@ func (w *Wasm) ExecLocal_Create(payload *types2.WasmCreate, tx *types.Transactio ...@@ -9,6 +9,10 @@ func (w *Wasm) ExecLocal_Create(payload *types2.WasmCreate, tx *types.Transactio
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
} }
func (w *Wasm) ExecLocal_Update(payload *types2.WasmUpdate, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
return &types.LocalDBSet{}, nil
}
func (w *Wasm) ExecLocal_Call(payload *types2.WasmCall, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) { func (w *Wasm) ExecLocal_Call(payload *types2.WasmCall, tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error) {
if receipt.Ty != types.ExecOk { if receipt.Ty != types.ExecOk {
return &types.LocalDBSet{}, nil return &types.LocalDBSet{}, nil
......
...@@ -5,9 +5,10 @@ package types; ...@@ -5,9 +5,10 @@ package types;
message wasmAction { message wasmAction {
oneof value { oneof value {
wasmCreate create = 1; wasmCreate create = 1;
wasmCall call = 2; wasmUpdate update = 2;
wasmCall call = 3;
} }
int32 ty = 3; int32 ty = 4;
} }
message wasmCreate { message wasmCreate {
...@@ -15,6 +16,11 @@ message wasmCreate { ...@@ -15,6 +16,11 @@ message wasmCreate {
bytes code = 2; bytes code = 2;
} }
message wasmUpdate {
string name = 1;
bytes code = 2;
}
message wasmCall { message wasmCall {
string contract = 1; string contract = 1;
string method = 2; string method = 2;
...@@ -35,6 +41,11 @@ message createContractLog { ...@@ -35,6 +41,11 @@ message createContractLog {
string code = 2; string code = 2;
} }
message updateContractLog {
string name = 1;
string code = 2;
}
message callContractLog { message callContractLog {
string contract = 1; string contract = 1;
string method = 2; string method = 2;
......
...@@ -3,7 +3,9 @@ package types ...@@ -3,7 +3,9 @@ package types
import "errors" import "errors"
var ( var (
ErrContractExist = errors.New("contract exist") ErrContractExist = errors.New("contract already exist")
ErrContractNotExist = errors.New("contract not exist")
ErrInvalidCreator = errors.New("invalid contract creator")
ErrInvalidWasm = errors.New("invalid wasm code") ErrInvalidWasm = errors.New("invalid wasm code")
ErrCodeOversize = errors.New("code oversize") ErrCodeOversize = errors.New("code oversize")
ErrInvalidMethod = errors.New("invalid method") ErrInvalidMethod = errors.New("invalid method")
......
...@@ -19,12 +19,14 @@ const ( ...@@ -19,12 +19,14 @@ const (
// action for executor // action for executor
const ( const (
WasmActionCreate = iota + 1 WasmActionCreate = iota + 1
WasmActionUpdate
WasmActionCall WasmActionCall
) )
// log ty for executor // log ty for executor
const ( const (
TyLogWasmCreate = iota + 100 TyLogWasmCreate = iota + 100
TyLogWasmUpdate
TyLogWasmCall TyLogWasmCall
TyLogCustom TyLogCustom
TyLogLocalData TyLogLocalData
...@@ -64,6 +66,7 @@ func (t *WasmType) GetPayload() types.Message { ...@@ -64,6 +66,7 @@ func (t *WasmType) GetPayload() types.Message {
func (t *WasmType) GetTypeMap() map[string]int32 { func (t *WasmType) GetTypeMap() map[string]int32 {
return map[string]int32{ return map[string]int32{
"Create": WasmActionCreate, "Create": WasmActionCreate,
"Update": WasmActionUpdate,
"Call": WasmActionCall, "Call": WasmActionCall,
} }
} }
...@@ -71,6 +74,7 @@ func (t *WasmType) GetTypeMap() map[string]int32 { ...@@ -71,6 +74,7 @@ func (t *WasmType) GetTypeMap() map[string]int32 {
func (t *WasmType) GetLogMap() map[int64]*types.LogInfo { func (t *WasmType) GetLogMap() map[int64]*types.LogInfo {
return map[int64]*types.LogInfo{ return map[int64]*types.LogInfo{
TyLogWasmCreate: {Ty: reflect.TypeOf(CreateContractLog{}), Name: "LogWasmCreate"}, TyLogWasmCreate: {Ty: reflect.TypeOf(CreateContractLog{}), Name: "LogWasmCreate"},
TyLogWasmUpdate: {Ty: reflect.TypeOf(UpdateContractLog{}), Name: "LogWasmUpdate"},
TyLogWasmCall: {Ty: reflect.TypeOf(CallContractLog{}), Name: "LogWasmCall"}, TyLogWasmCall: {Ty: reflect.TypeOf(CallContractLog{}), Name: "LogWasmCall"},
TyLogCustom: {Ty: reflect.TypeOf(CustomLog{}), Name: "LogWasmCustom"}, TyLogCustom: {Ty: reflect.TypeOf(CustomLog{}), Name: "LogWasmCustom"},
TyLogLocalData: {Ty: reflect.TypeOf(LocalDataLog{}), Name: "LogWasmLocalData"}, TyLogLocalData: {Ty: reflect.TypeOf(LocalDataLog{}), Name: "LogWasmLocalData"},
......
...@@ -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.
...@@ -24,9 +23,10 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package ...@@ -24,9 +23,10 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type WasmAction struct { type WasmAction struct {
// Types that are valid to be assigned to Value: // Types that are valid to be assigned to Value:
// *WasmAction_Create // *WasmAction_Create
// *WasmAction_Update
// *WasmAction_Call // *WasmAction_Call
Value isWasmAction_Value `protobuf_oneof:"value"` Value isWasmAction_Value `protobuf_oneof:"value"`
Ty int32 `protobuf:"varint,3,opt,name=ty,proto3" json:"ty,omitempty"` Ty int32 `protobuf:"varint,4,opt,name=ty,proto3" json:"ty,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:"-"`
...@@ -65,12 +65,18 @@ type WasmAction_Create struct { ...@@ -65,12 +65,18 @@ type WasmAction_Create struct {
Create *WasmCreate `protobuf:"bytes,1,opt,name=create,proto3,oneof"` Create *WasmCreate `protobuf:"bytes,1,opt,name=create,proto3,oneof"`
} }
type WasmAction_Update struct {
Update *WasmUpdate `protobuf:"bytes,2,opt,name=update,proto3,oneof"`
}
type WasmAction_Call struct { type WasmAction_Call struct {
Call *WasmCall `protobuf:"bytes,2,opt,name=call,proto3,oneof"` Call *WasmCall `protobuf:"bytes,3,opt,name=call,proto3,oneof"`
} }
func (*WasmAction_Create) isWasmAction_Value() {} func (*WasmAction_Create) isWasmAction_Value() {}
func (*WasmAction_Update) isWasmAction_Value() {}
func (*WasmAction_Call) isWasmAction_Value() {} func (*WasmAction_Call) isWasmAction_Value() {}
func (m *WasmAction) GetValue() isWasmAction_Value { func (m *WasmAction) GetValue() isWasmAction_Value {
...@@ -87,6 +93,13 @@ func (m *WasmAction) GetCreate() *WasmCreate { ...@@ -87,6 +93,13 @@ func (m *WasmAction) GetCreate() *WasmCreate {
return nil return nil
} }
func (m *WasmAction) GetUpdate() *WasmUpdate {
if x, ok := m.GetValue().(*WasmAction_Update); ok {
return x.Update
}
return nil
}
func (m *WasmAction) GetCall() *WasmCall { func (m *WasmAction) GetCall() *WasmCall {
if x, ok := m.GetValue().(*WasmAction_Call); ok { if x, ok := m.GetValue().(*WasmAction_Call); ok {
return x.Call return x.Call
...@@ -105,6 +118,7 @@ func (m *WasmAction) GetTy() int32 { ...@@ -105,6 +118,7 @@ func (m *WasmAction) GetTy() int32 {
func (*WasmAction) XXX_OneofWrappers() []interface{} { func (*WasmAction) XXX_OneofWrappers() []interface{} {
return []interface{}{ return []interface{}{
(*WasmAction_Create)(nil), (*WasmAction_Create)(nil),
(*WasmAction_Update)(nil),
(*WasmAction_Call)(nil), (*WasmAction_Call)(nil),
} }
} }
...@@ -156,6 +170,53 @@ func (m *WasmCreate) GetCode() []byte { ...@@ -156,6 +170,53 @@ func (m *WasmCreate) GetCode() []byte {
return nil return nil
} }
type WasmUpdate struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Code []byte `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WasmUpdate) Reset() { *m = WasmUpdate{} }
func (m *WasmUpdate) String() string { return proto.CompactTextString(m) }
func (*WasmUpdate) ProtoMessage() {}
func (*WasmUpdate) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{2}
}
func (m *WasmUpdate) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_WasmUpdate.Unmarshal(m, b)
}
func (m *WasmUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_WasmUpdate.Marshal(b, m, deterministic)
}
func (m *WasmUpdate) XXX_Merge(src proto.Message) {
xxx_messageInfo_WasmUpdate.Merge(m, src)
}
func (m *WasmUpdate) XXX_Size() int {
return xxx_messageInfo_WasmUpdate.Size(m)
}
func (m *WasmUpdate) XXX_DiscardUnknown() {
xxx_messageInfo_WasmUpdate.DiscardUnknown(m)
}
var xxx_messageInfo_WasmUpdate proto.InternalMessageInfo
func (m *WasmUpdate) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *WasmUpdate) GetCode() []byte {
if m != nil {
return m.Code
}
return nil
}
type WasmCall struct { type WasmCall 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"`
...@@ -170,7 +231,7 @@ func (m *WasmCall) Reset() { *m = WasmCall{} } ...@@ -170,7 +231,7 @@ func (m *WasmCall) Reset() { *m = WasmCall{} }
func (m *WasmCall) String() string { return proto.CompactTextString(m) } func (m *WasmCall) String() string { return proto.CompactTextString(m) }
func (*WasmCall) ProtoMessage() {} func (*WasmCall) ProtoMessage() {}
func (*WasmCall) Descriptor() ([]byte, []int) { func (*WasmCall) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{2} return fileDescriptor_7d78909ad64e3bbb, []int{3}
} }
func (m *WasmCall) XXX_Unmarshal(b []byte) error { func (m *WasmCall) XXX_Unmarshal(b []byte) error {
...@@ -230,7 +291,7 @@ func (m *QueryCheckContract) Reset() { *m = QueryCheckContract{} } ...@@ -230,7 +291,7 @@ func (m *QueryCheckContract) Reset() { *m = QueryCheckContract{} }
func (m *QueryCheckContract) String() string { return proto.CompactTextString(m) } func (m *QueryCheckContract) String() string { return proto.CompactTextString(m) }
func (*QueryCheckContract) ProtoMessage() {} func (*QueryCheckContract) ProtoMessage() {}
func (*QueryCheckContract) Descriptor() ([]byte, []int) { func (*QueryCheckContract) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{3} return fileDescriptor_7d78909ad64e3bbb, []int{4}
} }
func (m *QueryCheckContract) XXX_Unmarshal(b []byte) error { func (m *QueryCheckContract) XXX_Unmarshal(b []byte) error {
...@@ -269,7 +330,7 @@ func (m *CustomLog) Reset() { *m = CustomLog{} } ...@@ -269,7 +330,7 @@ func (m *CustomLog) Reset() { *m = CustomLog{} }
func (m *CustomLog) String() string { return proto.CompactTextString(m) } func (m *CustomLog) String() string { return proto.CompactTextString(m) }
func (*CustomLog) ProtoMessage() {} func (*CustomLog) ProtoMessage() {}
func (*CustomLog) Descriptor() ([]byte, []int) { func (*CustomLog) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{4} return fileDescriptor_7d78909ad64e3bbb, []int{5}
} }
func (m *CustomLog) XXX_Unmarshal(b []byte) error { func (m *CustomLog) XXX_Unmarshal(b []byte) error {
...@@ -309,7 +370,7 @@ func (m *CreateContractLog) Reset() { *m = CreateContractLog{} } ...@@ -309,7 +370,7 @@ func (m *CreateContractLog) Reset() { *m = CreateContractLog{} }
func (m *CreateContractLog) String() string { return proto.CompactTextString(m) } func (m *CreateContractLog) String() string { return proto.CompactTextString(m) }
func (*CreateContractLog) ProtoMessage() {} func (*CreateContractLog) ProtoMessage() {}
func (*CreateContractLog) Descriptor() ([]byte, []int) { func (*CreateContractLog) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{5} return fileDescriptor_7d78909ad64e3bbb, []int{6}
} }
func (m *CreateContractLog) XXX_Unmarshal(b []byte) error { func (m *CreateContractLog) XXX_Unmarshal(b []byte) error {
...@@ -344,6 +405,53 @@ func (m *CreateContractLog) GetCode() string { ...@@ -344,6 +405,53 @@ func (m *CreateContractLog) GetCode() string {
return "" return ""
} }
type UpdateContractLog struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateContractLog) Reset() { *m = UpdateContractLog{} }
func (m *UpdateContractLog) String() string { return proto.CompactTextString(m) }
func (*UpdateContractLog) ProtoMessage() {}
func (*UpdateContractLog) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{7}
}
func (m *UpdateContractLog) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateContractLog.Unmarshal(m, b)
}
func (m *UpdateContractLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateContractLog.Marshal(b, m, deterministic)
}
func (m *UpdateContractLog) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateContractLog.Merge(m, src)
}
func (m *UpdateContractLog) XXX_Size() int {
return xxx_messageInfo_UpdateContractLog.Size(m)
}
func (m *UpdateContractLog) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateContractLog.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateContractLog proto.InternalMessageInfo
func (m *UpdateContractLog) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *UpdateContractLog) GetCode() string {
if m != nil {
return m.Code
}
return ""
}
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"`
...@@ -357,7 +465,7 @@ func (m *CallContractLog) Reset() { *m = CallContractLog{} } ...@@ -357,7 +465,7 @@ func (m *CallContractLog) Reset() { *m = CallContractLog{} }
func (m *CallContractLog) String() string { return proto.CompactTextString(m) } func (m *CallContractLog) String() string { return proto.CompactTextString(m) }
func (*CallContractLog) ProtoMessage() {} func (*CallContractLog) ProtoMessage() {}
func (*CallContractLog) Descriptor() ([]byte, []int) { func (*CallContractLog) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{6} return fileDescriptor_7d78909ad64e3bbb, []int{8}
} }
func (m *CallContractLog) XXX_Unmarshal(b []byte) error { func (m *CallContractLog) XXX_Unmarshal(b []byte) error {
...@@ -411,7 +519,7 @@ func (m *LocalDataLog) Reset() { *m = LocalDataLog{} } ...@@ -411,7 +519,7 @@ func (m *LocalDataLog) Reset() { *m = LocalDataLog{} }
func (m *LocalDataLog) String() string { return proto.CompactTextString(m) } func (m *LocalDataLog) String() string { return proto.CompactTextString(m) }
func (*LocalDataLog) ProtoMessage() {} func (*LocalDataLog) ProtoMessage() {}
func (*LocalDataLog) Descriptor() ([]byte, []int) { func (*LocalDataLog) Descriptor() ([]byte, []int) {
return fileDescriptor_7d78909ad64e3bbb, []int{7} return fileDescriptor_7d78909ad64e3bbb, []int{9}
} }
func (m *LocalDataLog) XXX_Unmarshal(b []byte) error { func (m *LocalDataLog) XXX_Unmarshal(b []byte) error {
...@@ -449,40 +557,42 @@ func (m *LocalDataLog) GetValue() []byte { ...@@ -449,40 +557,42 @@ func (m *LocalDataLog) GetValue() []byte {
func init() { func init() {
proto.RegisterType((*WasmAction)(nil), "types.wasmAction") proto.RegisterType((*WasmAction)(nil), "types.wasmAction")
proto.RegisterType((*WasmCreate)(nil), "types.wasmCreate") proto.RegisterType((*WasmCreate)(nil), "types.wasmCreate")
proto.RegisterType((*WasmUpdate)(nil), "types.wasmUpdate")
proto.RegisterType((*WasmCall)(nil), "types.wasmCall") proto.RegisterType((*WasmCall)(nil), "types.wasmCall")
proto.RegisterType((*QueryCheckContract)(nil), "types.queryCheckContract") proto.RegisterType((*QueryCheckContract)(nil), "types.queryCheckContract")
proto.RegisterType((*CustomLog)(nil), "types.customLog") proto.RegisterType((*CustomLog)(nil), "types.customLog")
proto.RegisterType((*CreateContractLog)(nil), "types.createContractLog") proto.RegisterType((*CreateContractLog)(nil), "types.createContractLog")
proto.RegisterType((*UpdateContractLog)(nil), "types.updateContractLog")
proto.RegisterType((*CallContractLog)(nil), "types.callContractLog") proto.RegisterType((*CallContractLog)(nil), "types.callContractLog")
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{
// 337 bytes of a gzipped FileDescriptorProto // 370 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x31, 0x4f, 0xf3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x4d, 0x4b, 0xfb, 0x40,
0x10, 0x6d, 0xea, 0x36, 0x5f, 0x73, 0x5f, 0x45, 0x5b, 0x0b, 0x55, 0x11, 0x03, 0x44, 0x96, 0x90, 0x10, 0xc6, 0x9b, 0xe6, 0xe5, 0xdf, 0xcc, 0xbf, 0xd8, 0x76, 0x91, 0x12, 0x3c, 0x68, 0x08, 0x08,
0x22, 0x21, 0x75, 0x00, 0xc4, 0xc2, 0x04, 0x65, 0xe8, 0xc0, 0xe4, 0x9d, 0xc1, 0xb8, 0x86, 0x56, 0x01, 0xa1, 0x07, 0x15, 0x2f, 0x3d, 0x69, 0x3d, 0xf4, 0xe0, 0x69, 0xc1, 0xa3, 0x87, 0x75, 0xbb,
0x75, 0xe2, 0xe0, 0x5c, 0x8a, 0xf2, 0xef, 0x91, 0x1d, 0x17, 0x75, 0x40, 0x0c, 0x6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x60, 0xc8, 0x05, 0x25, 0xfc, 0x9e, 0x28, 0xa2, 0xbd, 0xc7,
0x00, 0xe0, 0x6f, 0x59, 0x6b, 0x6c, 0x87, 0x58, 0x97, 0xe8, 0xd8, 0x1d, 0x8b, 0x5b, 0xa6, 0x6d, 0x9e,
0x23, 0x73, 0xf0, 0x57, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x95, 0x09, 0x33, 0xfe, 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