From 04739270146ec9681b572cbe6cb697167bc52b2f Mon Sep 17 00:00:00 2001 From: vuong Date: Sat, 24 Sep 2022 00:22:33 +0700 Subject: [PATCH 01/35] add query to query.proto --- proto/cosmwasm/wasm/v1/query.proto | 17 + x/wasm/types/query.pb.go | 745 ++++++++++++++++++++--------- x/wasm/types/query.pb.gw.go | 210 +++++++- 3 files changed, 729 insertions(+), 243 deletions(-) diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index 41d959d800..58594fe342 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -63,6 +63,11 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/cosmwasm/wasm/v1/codes/params"; } + + // ContractsByCreator gets the contracts by creator + rpc ContractsByCreator(QueryContractsByCreatorRequest) returns (QueryContractsByCreatorResponse){ + option (google.api.http).get = "/cosmwasm/wasm/v1/contracts/creator/{creator_address}"; + } } // QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -236,3 +241,15 @@ message QueryParamsResponse { // params defines the parameters of the module. Params params = 1 [ (gogoproto.nullable) = false ]; } + +message QueryContractsByCreatorRequest { + // address is the address of creator + string creator_address = 1; +} + +message QueryContractsByCreatorResponse { +repeated string contract_address = 1 + [ (gogoproto.customname) = "contractAdress" ]; +// pagination defines the pagination in the response. +cosmos.base.query.v1beta1.PageResponse pagination = 2; +} \ No newline at end of file diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 0a45c5de82..8f8de87179 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -7,10 +7,6 @@ import ( bytes "bytes" context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -20,15 +16,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = math.Inf -) +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -49,11 +45,9 @@ func (*QueryContractInfoRequest) ProtoMessage() {} func (*QueryContractInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{0} } - func (m *QueryContractInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoRequest.Marshal(b, m, deterministic) @@ -66,15 +60,12 @@ func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } - func (m *QueryContractInfoRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoRequest.Merge(m, src) } - func (m *QueryContractInfoRequest) XXX_Size() int { return m.Size() } - func (m *QueryContractInfoRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoRequest.DiscardUnknown(m) } @@ -95,11 +86,9 @@ func (*QueryContractInfoResponse) ProtoMessage() {} func (*QueryContractInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{1} } - func (m *QueryContractInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoResponse.Marshal(b, m, deterministic) @@ -112,15 +101,12 @@ func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } - func (m *QueryContractInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoResponse.Merge(m, src) } - func (m *QueryContractInfoResponse) XXX_Size() int { return m.Size() } - func (m *QueryContractInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoResponse.DiscardUnknown(m) } @@ -142,11 +128,9 @@ func (*QueryContractHistoryRequest) ProtoMessage() {} func (*QueryContractHistoryRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{2} } - func (m *QueryContractHistoryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryRequest.Marshal(b, m, deterministic) @@ -159,15 +143,12 @@ func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractHistoryRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryRequest.Merge(m, src) } - func (m *QueryContractHistoryRequest) XXX_Size() int { return m.Size() } - func (m *QueryContractHistoryRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryRequest.DiscardUnknown(m) } @@ -188,11 +169,9 @@ func (*QueryContractHistoryResponse) ProtoMessage() {} func (*QueryContractHistoryResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{3} } - func (m *QueryContractHistoryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryResponse.Marshal(b, m, deterministic) @@ -205,15 +184,12 @@ func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractHistoryResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryResponse.Merge(m, src) } - func (m *QueryContractHistoryResponse) XXX_Size() int { return m.Size() } - func (m *QueryContractHistoryResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryResponse.DiscardUnknown(m) } @@ -234,11 +210,9 @@ func (*QueryContractsByCodeRequest) ProtoMessage() {} func (*QueryContractsByCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{4} } - func (m *QueryContractsByCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeRequest.Marshal(b, m, deterministic) @@ -251,15 +225,12 @@ func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractsByCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeRequest.Merge(m, src) } - func (m *QueryContractsByCodeRequest) XXX_Size() int { return m.Size() } - func (m *QueryContractsByCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeRequest.DiscardUnknown(m) } @@ -281,11 +252,9 @@ func (*QueryContractsByCodeResponse) ProtoMessage() {} func (*QueryContractsByCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{5} } - func (m *QueryContractsByCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeResponse.Marshal(b, m, deterministic) @@ -298,15 +267,12 @@ func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractsByCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeResponse.Merge(m, src) } - func (m *QueryContractsByCodeResponse) XXX_Size() int { return m.Size() } - func (m *QueryContractsByCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeResponse.DiscardUnknown(m) } @@ -328,11 +294,9 @@ func (*QueryAllContractStateRequest) ProtoMessage() {} func (*QueryAllContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{6} } - func (m *QueryAllContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateRequest.Marshal(b, m, deterministic) @@ -345,15 +309,12 @@ func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryAllContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateRequest.Merge(m, src) } - func (m *QueryAllContractStateRequest) XXX_Size() int { return m.Size() } - func (m *QueryAllContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateRequest.DiscardUnknown(m) } @@ -374,11 +335,9 @@ func (*QueryAllContractStateResponse) ProtoMessage() {} func (*QueryAllContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{7} } - func (m *QueryAllContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateResponse.Marshal(b, m, deterministic) @@ -391,15 +350,12 @@ func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryAllContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateResponse.Merge(m, src) } - func (m *QueryAllContractStateResponse) XXX_Size() int { return m.Size() } - func (m *QueryAllContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateResponse.DiscardUnknown(m) } @@ -420,11 +376,9 @@ func (*QueryRawContractStateRequest) ProtoMessage() {} func (*QueryRawContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{8} } - func (m *QueryRawContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateRequest.Marshal(b, m, deterministic) @@ -437,15 +391,12 @@ func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryRawContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateRequest.Merge(m, src) } - func (m *QueryRawContractStateRequest) XXX_Size() int { return m.Size() } - func (m *QueryRawContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateRequest.DiscardUnknown(m) } @@ -465,11 +416,9 @@ func (*QueryRawContractStateResponse) ProtoMessage() {} func (*QueryRawContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{9} } - func (m *QueryRawContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateResponse.Marshal(b, m, deterministic) @@ -482,15 +431,12 @@ func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryRawContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateResponse.Merge(m, src) } - func (m *QueryRawContractStateResponse) XXX_Size() int { return m.Size() } - func (m *QueryRawContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateResponse.DiscardUnknown(m) } @@ -512,11 +458,9 @@ func (*QuerySmartContractStateRequest) ProtoMessage() {} func (*QuerySmartContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{10} } - func (m *QuerySmartContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateRequest.Marshal(b, m, deterministic) @@ -529,15 +473,12 @@ func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } - func (m *QuerySmartContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateRequest.Merge(m, src) } - func (m *QuerySmartContractStateRequest) XXX_Size() int { return m.Size() } - func (m *QuerySmartContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateRequest.DiscardUnknown(m) } @@ -557,11 +498,9 @@ func (*QuerySmartContractStateResponse) ProtoMessage() {} func (*QuerySmartContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{11} } - func (m *QuerySmartContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateResponse.Marshal(b, m, deterministic) @@ -574,15 +513,12 @@ func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } - func (m *QuerySmartContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateResponse.Merge(m, src) } - func (m *QuerySmartContractStateResponse) XXX_Size() int { return m.Size() } - func (m *QuerySmartContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateResponse.DiscardUnknown(m) } @@ -600,11 +536,9 @@ func (*QueryCodeRequest) ProtoMessage() {} func (*QueryCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{12} } - func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeRequest.Marshal(b, m, deterministic) @@ -617,15 +551,12 @@ func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *QueryCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeRequest.Merge(m, src) } - func (m *QueryCodeRequest) XXX_Size() int { return m.Size() } - func (m *QueryCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeRequest.DiscardUnknown(m) } @@ -646,11 +577,9 @@ func (*CodeInfoResponse) ProtoMessage() {} func (*CodeInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{13} } - func (m *CodeInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeInfoResponse.Marshal(b, m, deterministic) @@ -663,15 +592,12 @@ func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *CodeInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeInfoResponse.Merge(m, src) } - func (m *CodeInfoResponse) XXX_Size() int { return m.Size() } - func (m *CodeInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_CodeInfoResponse.DiscardUnknown(m) } @@ -690,11 +616,9 @@ func (*QueryCodeResponse) ProtoMessage() {} func (*QueryCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{14} } - func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeResponse.Marshal(b, m, deterministic) @@ -707,15 +631,12 @@ func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *QueryCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeResponse.Merge(m, src) } - func (m *QueryCodeResponse) XXX_Size() int { return m.Size() } - func (m *QueryCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeResponse.DiscardUnknown(m) } @@ -734,11 +655,9 @@ func (*QueryCodesRequest) ProtoMessage() {} func (*QueryCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{15} } - func (m *QueryCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesRequest.Marshal(b, m, deterministic) @@ -751,15 +670,12 @@ func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *QueryCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesRequest.Merge(m, src) } - func (m *QueryCodesRequest) XXX_Size() int { return m.Size() } - func (m *QueryCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesRequest.DiscardUnknown(m) } @@ -779,11 +695,9 @@ func (*QueryCodesResponse) ProtoMessage() {} func (*QueryCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{16} } - func (m *QueryCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesResponse.Marshal(b, m, deterministic) @@ -796,15 +710,12 @@ func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesResponse.Merge(m, src) } - func (m *QueryCodesResponse) XXX_Size() int { return m.Size() } - func (m *QueryCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesResponse.DiscardUnknown(m) } @@ -824,11 +735,9 @@ func (*QueryPinnedCodesRequest) ProtoMessage() {} func (*QueryPinnedCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{17} } - func (m *QueryPinnedCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesRequest.Marshal(b, m, deterministic) @@ -841,15 +750,12 @@ func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *QueryPinnedCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesRequest.Merge(m, src) } - func (m *QueryPinnedCodesRequest) XXX_Size() int { return m.Size() } - func (m *QueryPinnedCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesRequest.DiscardUnknown(m) } @@ -870,11 +776,9 @@ func (*QueryPinnedCodesResponse) ProtoMessage() {} func (*QueryPinnedCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{18} } - func (m *QueryPinnedCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesResponse.Marshal(b, m, deterministic) @@ -887,15 +791,12 @@ func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } - func (m *QueryPinnedCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesResponse.Merge(m, src) } - func (m *QueryPinnedCodesResponse) XXX_Size() int { return m.Size() } - func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesResponse.DiscardUnknown(m) } @@ -903,7 +804,8 @@ func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPinnedCodesResponse proto.InternalMessageInfo // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct{} +type QueryParamsRequest struct { +} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -911,11 +813,9 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{19} } - func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -928,15 +828,12 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } - func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } - func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -955,11 +852,9 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{20} } - func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -972,21 +867,95 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } - func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } - func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +type QueryContractsByCreatorRequest struct { + // address is the address of creator + CreatorAddress string `protobuf:"bytes,1,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` +} + +func (m *QueryContractsByCreatorRequest) Reset() { *m = QueryContractsByCreatorRequest{} } +func (m *QueryContractsByCreatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryContractsByCreatorRequest) ProtoMessage() {} +func (*QueryContractsByCreatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{21} +} +func (m *QueryContractsByCreatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryContractsByCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryContractsByCreatorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryContractsByCreatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryContractsByCreatorRequest.Merge(m, src) +} +func (m *QueryContractsByCreatorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryContractsByCreatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryContractsByCreatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryContractsByCreatorRequest proto.InternalMessageInfo + +type QueryContractsByCreatorResponse struct { + contractAdress []string `protobuf:"bytes,1,rep,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryContractsByCreatorResponse) Reset() { *m = QueryContractsByCreatorResponse{} } +func (m *QueryContractsByCreatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryContractsByCreatorResponse) ProtoMessage() {} +func (*QueryContractsByCreatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{22} +} +func (m *QueryContractsByCreatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryContractsByCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryContractsByCreatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryContractsByCreatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryContractsByCreatorResponse.Merge(m, src) +} +func (m *QueryContractsByCreatorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryContractsByCreatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryContractsByCreatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryContractsByCreatorResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryContractInfoRequest)(nil), "cosmwasm.wasm.v1.QueryContractInfoRequest") proto.RegisterType((*QueryContractInfoResponse)(nil), "cosmwasm.wasm.v1.QueryContractInfoResponse") @@ -1009,90 +978,98 @@ func init() { proto.RegisterType((*QueryPinnedCodesResponse)(nil), "cosmwasm.wasm.v1.QueryPinnedCodesResponse") proto.RegisterType((*QueryParamsRequest)(nil), "cosmwasm.wasm.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "cosmwasm.wasm.v1.QueryParamsResponse") + proto.RegisterType((*QueryContractsByCreatorRequest)(nil), "cosmwasm.wasm.v1.QueryContractsByCreatorRequest") + proto.RegisterType((*QueryContractsByCreatorResponse)(nil), "cosmwasm.wasm.v1.QueryContractsByCreatorResponse") } func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1245 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0x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 0xfb, 0x20, 0x11, 0xea, 0x4f, 0xdb, 0x64, 0x63, 0xc5, 0xba, 0xb7, 0x76, 0x20, 0xdb, 0x38, - 0x4c, 0x97, 0xa9, 0x45, 0x36, 0x6c, 0x4b, 0xc8, 0x96, 0x34, 0x53, 0xde, 0xed, 0x8a, 0x35, 0x30, - 0xd5, 0xbe, 0x68, 0x57, 0xad, 0x05, 0x20, 0x55, 0x9b, 0x80, 0xd9, 0x60, 0xb7, 0x7d, 0xdd, 0xb2, - 0xe6, 0xd9, 0x83, 0xc1, 0xe9, 0xf0, 0x79, 0xc0, 0x71, 0x7b, 0x7b, 0x3b, 0x40, 0xb9, 0xcf, 0x31, - 0x27, 0xcf, 0xaf, 0x80, 0x7e, 0x04, 0xf0, 0x6a, 0x0c, 0x82, 0xd4, 0x62, 0x11, 0xa6, 0xaa, 0xd4, - 0x22, 0xdb, 0x41, 0x01, 0x8d, 0x77, 0x16, 0xd0, 0x9a, 0xf7, 0x5e, 0x56, 0x8b, 0x34, 0x1e, 0x9c, - 0x48, 0x0f, 0xa4, 0x46, 0x26, 0xde, 0xbf, 0xa0, 0x46, 0x57, 0x21, 0x14, 0x6b, 0x6c, 0x58, 0x98, - 0x63, 0x81, 0x30, 0x6a, 0x66, 0xc5, 0x93, 0x3b, 0x98, 0x63, 0xed, 0xa6, 0xcc, 0xbc, 0x33, 0xb0, - 0xcc, 0x1c, 0xc1, 0xa4, 0xf0, 0x04, 0xc2, 0x53, 0x5c, 0x6b, 0x3b, 0x50, 0x11, 0x4e, 0xf7, 0xab, - 0xd8, 0xe5, 0x17, 0xe4, 0x59, 0xec, 0xe4, 0x29, 0x8e, 0x3d, 0x6d, 0xa8, 0x28, 0x44, 0xb0, 0x46, - 0x18, 0xf3, 0x94, 0x08, 0x71, 0xae, 0x41, 0x35, 0x76, 0x49, 0x49, 0x3a, 0x13, 0x26, 0x8d, 0x8d, - 0xe9, 0x67, 0x70, 0x03, 0xe6, 0x64, 0xed, 0xf7, 0xfe, 0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, 0x4f, 0x00, 0xbc, 0xdc, 0x36, 0x01, 0xa1, 0x37, 0x7b, 0x2c, 0x17, 0x9d, 0xd5, - 0x0a, 0x7a, 0xbf, 0xe6, 0x12, 0x70, 0x41, 0x00, 0xea, 0x68, 0xb6, 0x1f, 0x40, 0x63, 0x4b, 0x42, - 0xfd, 0x1c, 0x02, 0x95, 0x43, 0x47, 0x4f, 0xd0, 0xe8, 0x74, 0xd4, 0x13, 0xb4, 0x6d, 0x96, 0xd1, - 0xe6, 0x05, 0xe8, 0x2c, 0x9a, 0xe9, 0x06, 0x6a, 0x11, 0xe3, 0x40, 0x56, 0xed, 0xa1, 0x71, 0x36, - 0xe1, 0xfc, 0x02, 0x60, 0xae, 0x7d, 0x20, 0x40, 0x71, 0x0b, 0xc7, 0x0c, 0x2f, 0x05, 0xa3, 0x6f, - 0xfb, 0x7e, 0x48, 0x3b, 0x24, 0x65, 0x02, 0xea, 0x37, 0x00, 0x73, 0xed, 0x07, 0x78, 0x2c, 0x69, - 0xcc, 0x08, 0x11, 0x4b, 0x1a, 0x37, 0x19, 0x68, 0xef, 0x0b, 0xd2, 0x5b, 0x68, 0xb1, 0x2f, 0x52, - 0x17, 0xef, 0x1b, 0x07, 0x67, 0x27, 0xff, 0x21, 0xfa, 0x03, 0x40, 0xd4, 0x79, 0x9a, 0xa3, 0xb7, - 0x62, 0x30, 0x62, 0x67, 0x8d, 0xc2, 0xdc, 0x05, 0x3c, 0x24, 0xfa, 0x07, 0x02, 0xfd, 0x5d, 0x74, - 0xab, 0x3f, 0x91, 0xbd, 0x40, 0x51, 0xf8, 0x3a, 0x4c, 0x8a, 0xb2, 0xd5, 0x62, 0xeb, 0xf0, 0xac, - 0x56, 0x5f, 0x3b, 0xd7, 0x46, 0x12, 0x4d, 0x0b, 0x22, 0x0d, 0x4d, 0xf6, 0x2a, 0x50, 0xe4, 0xc2, - 0x61, 0xd1, 0x73, 0xd1, 0x79, 0x71, 0x83, 0x2e, 0x58, 0xb8, 0x76, 0xbe, 0x91, 0x5c, 0x5d, 0x11, - 0xab, 0xe7, 0xd1, 0x58, 0xf7, 0xd5, 0xd1, 0x57, 0x00, 0x8e, 0x84, 0xda, 0x3d, 0xba, 0x1e, 0x13, - 0xb5, 0xf3, 0xd8, 0x29, 0xcc, 0xf4, 0x63, 0x2a, 0x31, 0xa6, 0x04, 0xc6, 0x24, 0x52, 0xba, 0x63, - 0x30, 0xa3, 0x26, 0x9c, 0xd0, 0x21, 0x4c, 0xf9, 0x3d, 0x1a, 0xc5, 0xa5, 0x17, 0x39, 0x0a, 0x0a, - 0xaf, 0xf7, 0xb0, 0xea, 0x7b, 0x79, 0xff, 0x60, 0x58, 0x3e, 0xfa, 0x47, 0x49, 0xfc, 0xda, 0x54, - 0x12, 0x47, 0x4d, 0x05, 0x1c, 0x37, 0x15, 0xf0, 0x77, 0x53, 0x01, 0xdf, 0x9e, 0x28, 0x89, 0xe3, - 0x13, 0x25, 0xf1, 0xd7, 0x89, 0x92, 0xf8, 0x64, 0x2a, 0x34, 0xc0, 0x2d, 0x51, 0x56, 0x7d, 0x10, - 0xc4, 0xb2, 0x8c, 0x47, 0x7e, 0x4c, 0xf1, 0x8f, 0x42, 0x29, 0x25, 0xfe, 0x08, 0xb8, 0xf9, 0x7f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xa4, 0x0e, 0x41, 0xb8, 0x10, 0x00, 0x00, + // 1334 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0xdb, 0x54, + 0x1c, 0xcf, 0xeb, 0xd2, 0xfc, 0x78, 0xeb, 0xd6, 0xf0, 0x18, 0x6d, 0x08, 0x9d, 0x5d, 0x99, 0xd1, + 0x75, 0x5d, 0xb1, 0x69, 0xd7, 0x32, 0x40, 0x9a, 0x50, 0xd3, 0xc1, 0xda, 0x4a, 0x95, 0x3a, 0x4f, + 0x68, 0x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x4a, 0x64, 0x1e, 0xb6, 0x72, 0xf5, 0xd5, + 0x33, 0x65, 0x04, 0xa2, 0x69, 0x8e, 0x48, 0x41, 0x93, 0xbd, 0x12, 0x14, 0x39, 0x70, 0x98, 0x8f, + 0x1a, 0x74, 0x96, 0x5d, 0xbf, 0xf9, 0xe7, 0xae, 0x9d, 0x2d, 0x24, 0xbc, 0x4b, 0xdc, 0x7b, 0x16, + 0x8d, 0x75, 0xf7, 0x8e, 0x3e, 0x03, 0xf0, 0x62, 0x60, 0xca, 0xa1, 0x1b, 0x11, 0x56, 0x3b, 0xa7, + 0x6d, 0x6e, 0xa6, 0x1f, 0x51, 0x01, 0x63, 0x8a, 0xc3, 0x98, 0x44, 0x52, 0x77, 0x18, 0x54, 0xab, + 0x72, 0x25, 0x74, 0x08, 0x13, 0xde, 0x68, 0x42, 0x51, 0xe1, 0x85, 0x26, 0x60, 0xee, 0xb5, 0x1e, + 0x52, 0x7d, 0xbb, 0xf7, 0x9c, 0xfe, 0x0a, 0x20, 0xea, 0x9c, 0x58, 0x91, 0x99, 0x1b, 0x39, 0x28, + 0x23, 0x33, 0x37, 0x7a, 0x1c, 0xf6, 0x53, 0x74, 0x54, 0x13, 0x63, 0x56, 0x3b, 0x68, 0x1b, 0xc3, + 0x87, 0xf9, 0x95, 0xa3, 0xbf, 0xa5, 0xd8, 0x8f, 0x0d, 0x29, 0x76, 0xd4, 0x90, 0xc0, 0x71, 0x43, + 0x02, 0x7f, 0x35, 0x24, 0xf0, 0xe5, 0x89, 0x14, 0x3b, 0x3e, 0x91, 0x62, 0x7f, 0x9e, 0x48, 0xb1, + 0x0f, 0xa7, 0x02, 0x2b, 0xf7, 0xb2, 0x4d, 0x2b, 0x0f, 0x7d, 0x17, 0x86, 0xf6, 0xd8, 0x73, 0xc5, + 0xff, 0x03, 0x2a, 0x26, 0xf8, 0x5f, 0x37, 0xb7, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x05, 0x2c, + 0x06, 0xa6, 0x6a, 0x12, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1122,7 +1099,6 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool { } return true } - func (this *CodeInfoResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1156,7 +1132,6 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool { } return true } - func (this *QueryCodeResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1217,6 +1192,8 @@ type QueryClient interface { PinnedCodes(ctx context.Context, in *QueryPinnedCodesRequest, opts ...grpc.CallOption) (*QueryPinnedCodesResponse, error) // Params gets the module params Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // ContractsByCreator gets the contracts by creator + ContractsByCreator(ctx context.Context, in *QueryContractsByCreatorRequest, opts ...grpc.CallOption) (*QueryContractsByCreatorResponse, error) } type queryClient struct { @@ -1317,6 +1294,15 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } +func (c *queryClient) ContractsByCreator(ctx context.Context, in *QueryContractsByCreatorRequest, opts ...grpc.CallOption) (*QueryContractsByCreatorResponse, error) { + out := new(QueryContractsByCreatorResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/ContractsByCreator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ContractInfo gets the contract meta data @@ -1339,50 +1325,47 @@ type QueryServer interface { PinnedCodes(context.Context, *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) // Params gets the module params Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // ContractsByCreator gets the contracts by creator + ContractsByCreator(context.Context, *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct{} +type UnimplementedQueryServer struct { +} func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryContractInfoRequest) (*QueryContractInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") } - func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") } - func (*UnimplementedQueryServer) ContractsByCode(ctx context.Context, req *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractsByCode not implemented") } - func (*UnimplementedQueryServer) AllContractState(ctx context.Context, req *QueryAllContractStateRequest) (*QueryAllContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllContractState not implemented") } - func (*UnimplementedQueryServer) RawContractState(ctx context.Context, req *QueryRawContractStateRequest) (*QueryRawContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawContractState not implemented") } - func (*UnimplementedQueryServer) SmartContractState(ctx context.Context, req *QuerySmartContractStateRequest) (*QuerySmartContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SmartContractState not implemented") } - func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") } - func (*UnimplementedQueryServer) Codes(ctx context.Context, req *QueryCodesRequest) (*QueryCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") } - func (*UnimplementedQueryServer) PinnedCodes(ctx context.Context, req *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PinnedCodes not implemented") } - func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedQueryServer) ContractsByCreator(ctx context.Context, req *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractsByCreator not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1568,6 +1551,24 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Query_ContractsByCreator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryContractsByCreatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ContractsByCreator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Query/ContractsByCreator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractsByCreator(ctx, req.(*QueryContractsByCreatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmwasm.wasm.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1612,6 +1613,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, + { + MethodName: "ContractsByCreator", + Handler: _Query_ContractsByCreator_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmwasm/wasm/v1/query.proto", @@ -2437,6 +2442,80 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryContractsByCreatorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryContractsByCreatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractsByCreatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CreatorAddress) > 0 { + i -= len(m.CreatorAddress) + copy(dAtA[i:], m.CreatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CreatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryContractsByCreatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryContractsByCreatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractsByCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.contractAdress) > 0 { + for iNdEx := len(m.contractAdress) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.contractAdress[iNdEx]) + copy(dAtA[i:], m.contractAdress[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.contractAdress[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2448,7 +2527,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *QueryContractInfoRequest) Size() (n int) { if m == nil { return 0 @@ -2780,14 +2858,44 @@ func (m *QueryParamsResponse) Size() (n int) { return n } +func (m *QueryContractsByCreatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CreatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractsByCreatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.contractAdress) > 0 { + for _, s := range m.contractAdress { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2870,7 +2978,6 @@ func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2986,7 +3093,6 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3105,7 +3211,6 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3226,7 +3331,6 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3332,7 +3436,6 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3451,7 +3554,6 @@ func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3570,7 +3672,6 @@ func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3691,7 +3792,6 @@ func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3808,7 +3908,6 @@ func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3893,7 +3992,6 @@ func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4010,7 +4108,6 @@ func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4095,7 +4192,6 @@ func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4165,7 +4261,6 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4334,7 +4429,6 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4455,7 +4549,6 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4542,7 +4635,6 @@ func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4663,7 +4755,6 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4750,7 +4841,6 @@ func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4913,7 +5003,6 @@ func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4964,7 +5053,6 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5048,7 +5136,206 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryContractsByCreatorRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractsByCreatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractsByCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CreatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractsByCreatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractsByCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field contractAdress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.contractAdress = append(m.contractAdress, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/query.pb.gw.go b/x/wasm/types/query.pb.gw.go index d50c1a5d8e..a31c70c1fe 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -20,19 +20,18 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) // Suppress "imported and not used" errors var _ codes.Code - -var ( - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage -) +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractInfoRequest @@ -58,6 +57,7 @@ func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.ContractInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,9 +84,12 @@ func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.M msg, err := server.ContractInfo(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractHistoryRequest @@ -119,6 +122,7 @@ func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -152,9 +156,12 @@ func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtim msg, err := server.ContractHistory(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCodeRequest @@ -187,6 +194,7 @@ func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractsByCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -220,9 +228,12 @@ func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtim msg, err := server.ContractsByCode(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllContractStateRequest @@ -255,6 +266,7 @@ func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.AllContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -288,6 +300,7 @@ func local_request_Query_AllContractState_0(ctx context.Context, marshaler runti msg, err := server.AllContractState(ctx, &protoReq) return msg, metadata, err + } func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -325,6 +338,7 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.RawContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -362,6 +376,7 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti msg, err := server.RawContractState(ctx, &protoReq) return msg, metadata, err + } func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -399,6 +414,7 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M msg, err := client.SmartContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -436,6 +452,7 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run msg, err := server.SmartContractState(ctx, &protoReq) return msg, metadata, err + } func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -462,6 +479,7 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -488,9 +506,12 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler msg, err := server.Code(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var ( + filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryCodesRequest @@ -505,6 +526,7 @@ func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, cli msg, err := client.Codes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -520,9 +542,12 @@ func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshale msg, err := server.Codes(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var ( + filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryPinnedCodesRequest @@ -537,6 +562,7 @@ func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.PinnedCodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -552,6 +578,7 @@ func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Ma msg, err := server.PinnedCodes(ctx, &protoReq) return msg, metadata, err + } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -560,6 +587,7 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -568,16 +596,74 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err + +} + +func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryContractsByCreatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["creator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator_address") + } + + protoReq.CreatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator_address", err) + } + + msg, err := client.ContractsByCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryContractsByCreatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["creator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator_address") + } + + protoReq.CreatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator_address", err) + } + + msg, err := server.ContractsByCreator(ctx, &protoReq) + return msg, metadata, err + } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -585,6 +671,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -592,11 +679,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -604,6 +694,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -611,11 +702,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -623,6 +717,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractsByCode_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -630,11 +725,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -642,6 +740,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_AllContractState_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -649,11 +748,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -661,6 +763,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_RawContractState_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -668,11 +771,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -680,6 +786,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SmartContractState_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -687,11 +794,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -699,6 +809,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -706,11 +817,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -718,6 +832,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -725,11 +840,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -737,6 +855,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_PinnedCodes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -744,11 +863,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -756,6 +878,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -763,6 +886,30 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ContractsByCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ContractsByCreator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -805,6 +952,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -822,6 +970,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -841,6 +990,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -860,6 +1010,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -879,6 +1030,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -898,6 +1050,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -917,6 +1070,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -936,6 +1090,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -955,6 +1110,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -974,6 +1130,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -993,6 +1150,27 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ContractsByCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ContractsByCreator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -1018,6 +1196,8 @@ var ( pattern_Query_PinnedCodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "codes", "pinned"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "codes", "params"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_ContractsByCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmwasm", "wasm", "v1", "contracts", "creator", "creator_address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -1040,4 +1220,6 @@ var ( forward_Query_PinnedCodes_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_ContractsByCreator_0 = runtime.ForwardResponseMessage ) From 0c628d227777078bd79a1b222477ce81350fe111 Mon Sep 17 00:00:00 2001 From: vuong Date: Sat, 24 Sep 2022 00:26:20 +0700 Subject: [PATCH 02/35] add ContractsByCreatorPrefix in keys.go --- x/wasm/types/keys.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index fb636ef4f3..e49ac089dc 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -31,6 +31,7 @@ var ( ContractByCodeIDAndCreatedSecondaryIndexPrefix = []byte{0x06} PinnedCodeIndexPrefix = []byte{0x07} TXCounterPrefix = []byte{0x08} + ContractsByCreatorPrefix = []byte{0x09} KeyLastCodeID = append(SequenceKeyPrefix, []byte("lastCodeId")...) KeyLastInstanceID = append(SequenceKeyPrefix, []byte("lastContractId")...) @@ -47,6 +48,11 @@ func GetContractAddressKey(addr sdk.AccAddress) []byte { return append(ContractKeyPrefix, addr...) } +// GetContractsByCreatorPrefix returns the contracts by creator prefix for the WASM contract instance +func GetContractsByCreatorPrefix(addr sdk.AccAddress) []byte { + return append(ContractsByCreatorPrefix, addr...) +} + // GetContractStorePrefix returns the store prefix for the WASM contract instance func GetContractStorePrefix(addr sdk.AccAddress) []byte { return append(ContractStorePrefix, addr...) @@ -75,6 +81,12 @@ func GetContractByCodeIDSecondaryIndexPrefix(codeID uint64) []byte { return r } +// GetContractByCodeIDSecondaryIndexPrefix returns the prefix for the second index: `` +func GetContractByCreatorThirdIndexPrefix(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { + prefixBytes := GetContractsByCreatorPrefix(addr) + return append(prefixBytes, contractAddr...) +} + // GetContractCodeHistoryElementKey returns the key a contract code history entry: `` func GetContractCodeHistoryElementKey(contractAddr sdk.AccAddress, pos uint64) []byte { prefix := GetContractCodeHistoryElementPrefix(contractAddr) From 8e40535805847089b3cdccb7e14e28f01b78577a Mon Sep 17 00:00:00 2001 From: vuong Date: Sat, 24 Sep 2022 00:43:28 +0700 Subject: [PATCH 03/35] add ContractCreatorThirdIndex to keeper.go --- x/wasm/keeper/genesis_test.go | 3 +++ x/wasm/keeper/keeper.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index aee7ad009e..ea4282b753 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -110,7 +110,10 @@ func TestGenesisExportImport(t *testing.T) { // reset contract code index in source DB for comparison with dest DB wasmKeeper.IterateContractInfo(srcCtx, func(address sdk.AccAddress, info wasmTypes.ContractInfo) bool { + creatorAddress, _ := sdk.AccAddressFromBech32(info.Creator) wasmKeeper.removeFromContractCodeSecondaryIndex(srcCtx, address, wasmKeeper.getLastContractHistoryEntry(srcCtx, address)) + wasmKeeper.removeFromContractCreatorThirdIndex(srcCtx, creatorAddress, address) + prefixStore := prefix.NewStore(srcCtx.KVStore(wasmKeeper.storeKey), types.GetContractCodeHistoryElementPrefix(address)) iter := prefixStore.Iterator(nil, nil) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index f29f6e18ed..62f61e5e03 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -378,6 +378,7 @@ func (k Keeper) instantiate( // store contract before dispatch so that contract could be called back historyEntry := contractInfo.InitialHistory(initMsg) k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) + k.addToContractCreatorThirdIndex(ctx, creator, contractAddress) k.appendToContractHistory(ctx, contractAddress, historyEntry) k.storeContractInfo(ctx, contractAddress, &contractInfo) @@ -489,13 +490,16 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller if err != nil { return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) } + creatorAddress, err := sdk.AccAddressFromBech32(contractInfo.Creator) // delete old secondary index entry k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.getLastContractHistoryEntry(ctx, contractAddress)) + k.removeFromContractCreatorThirdIndex(ctx, creatorAddress, contractAddress) // persist migration updates historyEntry := contractInfo.AddMigration(ctx, newCodeID, msg) k.appendToContractHistory(ctx, contractAddress, historyEntry) k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) + k.addToContractCreatorThirdIndex(ctx, creatorAddress, contractAddress) k.storeContractInfo(ctx, contractAddress, contractInfo) ctx.EventManager().EmitEvent(sdk.NewEvent( @@ -596,6 +600,28 @@ func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAd ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatedSecondaryIndexKey(contractAddress, entry)) } +// addToContractCreatorThirdIndex adds element to the index for contracts-by-creator queries +func (k Keeper) addToContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + store.Set(types.GetContractByCreatorThirdIndexPrefix(creatorAddress, contractAddress), []byte{}) +} + +// removeFromContractCodeSecondaryIndex removes element to the index for contracts-by-creator queries +func (k Keeper) removeFromContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { + ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatorThirdIndexPrefix(creatorAddress, contractAddress)) +} + +// IterateContractsByCode iterates over all contracts with given creator address. +func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { + prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) + for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { + key := iter.Key() + if cb(key[types.AbsoluteTxPositionLen:]) { + return + } + } +} + // IterateContractsByCode iterates over all contracts with given codeID ASC on code update time. func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool) { prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractByCodeIDSecondaryIndexPrefix(codeID)) @@ -1051,10 +1077,15 @@ func (k Keeper) importContract(ctx sdk.Context, contractAddr sdk.AccAddress, c * return sdkerrors.Wrapf(types.ErrDuplicate, "contract: %s", contractAddr) } + creatorAddress, err := sdk.AccAddressFromBech32(c.Creator) + if err != nil { + return err + } historyEntry := c.ResetFromGenesis(ctx) k.appendToContractHistory(ctx, contractAddr, historyEntry) k.storeContractInfo(ctx, contractAddr, c) k.addToContractCodeSecondaryIndex(ctx, contractAddr, historyEntry) + k.addToContractCreatorThirdIndex(ctx, creatorAddress, contractAddr) return k.importContractState(ctx, contractAddr, state) } From 6fd112a0a116c50ce101ed722c72dada22081d13 Mon Sep 17 00:00:00 2001 From: vuong Date: Sat, 24 Sep 2022 01:09:12 +0700 Subject: [PATCH 04/35] add querier --- proto/cosmwasm/wasm/v1/query.proto | 8 +- x/wasm/keeper/querier.go | 21 ++ x/wasm/types/exported_keepers.go | 1 + x/wasm/types/query.pb.go | 299 ++++++++++++++--------------- x/wasm/types/query.pb.gw.go | 18 ++ 5 files changed, 193 insertions(+), 154 deletions(-) diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index 58594fe342..6fcc2189b4 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -245,11 +245,11 @@ message QueryParamsResponse { message QueryContractsByCreatorRequest { // address is the address of creator string creator_address = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 2; + } message QueryContractsByCreatorResponse { -repeated string contract_address = 1 - [ (gogoproto.customname) = "contractAdress" ]; -// pagination defines the pagination in the response. -cosmos.base.query.v1beta1.PageResponse pagination = 2; + repeated string contract_address = 1 + [ (gogoproto.customname) = "ContractAddress" ]; } \ No newline at end of file diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index 8cd882c7a8..b225fe1dee 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -318,3 +318,24 @@ func (q grpcQuerier) Params(c context.Context, req *types.QueryParamsRequest) (* params := q.keeper.GetParams(ctx) return &types.QueryParamsResponse{Params: params}, nil } + +func (q grpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContractsByCreatorRequest) (*types.QueryContractsByCreatorResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + ctx := sdk.UnwrapSDKContext(c) + contracts := make([]string, 0) + + creatorAddress, err := sdk.AccAddressFromBech32(req.CreatorAddress) + if err != nil { + return nil, err + } + q.keeper.IterateContractsByCreator(ctx, creatorAddress, func(addr sdk.AccAddress) bool { + contracts = append(contracts, addr.String()) + return false + }) + + return &types.QueryContractsByCreatorResponse{ + ContractAddress: contracts, + }, nil +} diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go index e68df8ee7b..dcf97cb2cc 100644 --- a/x/wasm/types/exported_keepers.go +++ b/x/wasm/types/exported_keepers.go @@ -14,6 +14,7 @@ type ViewKeeper interface { HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool GetContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) *ContractInfo IterateContractInfo(ctx sdk.Context, cb func(sdk.AccAddress, ContractInfo) bool) + IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool) IterateContractState(ctx sdk.Context, contractAddress sdk.AccAddress, cb func(key, value []byte) bool) GetCodeInfo(ctx sdk.Context, codeID uint64) *CodeInfo diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 8f8de87179..712d828df5 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -881,7 +881,8 @@ var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo type QueryContractsByCreatorRequest struct { // address is the address of creator - CreatorAddress string `protobuf:"bytes,1,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` + CreatorAddress string `protobuf:"bytes,1,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryContractsByCreatorRequest) Reset() { *m = QueryContractsByCreatorRequest{} } @@ -918,9 +919,7 @@ func (m *QueryContractsByCreatorRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryContractsByCreatorRequest proto.InternalMessageInfo type QueryContractsByCreatorResponse struct { - contractAdress []string `protobuf:"bytes,1,rep,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + ContractAddress []string `protobuf:"bytes,1,rep,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` } func (m *QueryContractsByCreatorResponse) Reset() { *m = QueryContractsByCreatorResponse{} } @@ -985,91 +984,91 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0xdb, 0x54, - 0x1c, 0xcf, 0xeb, 0xd2, 0xfc, 0x78, 0xeb, 0xd6, 0xf0, 0x18, 0x6d, 0x08, 0x9d, 0x5d, 0x99, 0xd1, - 0x75, 0x5d, 0xb1, 0x69, 0xd7, 0x32, 0x40, 0x9a, 0x50, 0xd3, 0xc1, 0xda, 0x4a, 0x95, 0x3a, 0x4f, - 0x68, 0x12, 0x3b, 0x44, 0x2f, 0xf1, 0x6b, 0x6a, 0xa9, 0xb1, 0x53, 0xbf, 0xd7, 0x76, 0x51, 0x55, - 0x40, 0x93, 0xb8, 0x21, 0x40, 0x42, 0x1c, 0x11, 0x1c, 0xd0, 0x80, 0x2b, 0x5c, 0x10, 0x57, 0x2e, - 0x3d, 0x56, 0xe2, 0xc2, 0x29,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 0xdc, 0x7b, 0x16, - 0x8d, 0x75, 0xf7, 0x8e, 0x3e, 0x03, 0xf0, 0x62, 0x60, 0xca, 0xa1, 0x1b, 0x11, 0x56, 0x3b, 0xa7, - 0x6d, 0x6e, 0xa6, 0x1f, 0x51, 0x01, 0x63, 0x8a, 0xc3, 0x98, 0x44, 0x52, 0x77, 0x18, 0x54, 0xab, - 0x72, 0x25, 0x74, 0x08, 0x13, 0xde, 0x68, 0x42, 0x51, 0xe1, 0x85, 0x26, 0x60, 0xee, 0xb5, 0x1e, - 0x52, 0x7d, 0xbb, 0xf7, 0x9c, 0xfe, 0x0a, 0x20, 0xea, 0x9c, 0x58, 0x91, 0x99, 0x1b, 0x39, 0x28, - 0x23, 0x33, 0x37, 0x7a, 0x1c, 0xf6, 0x53, 0x74, 0x54, 0x13, 0x63, 0x56, 0x3b, 0x68, 0x1b, 0xc3, - 0x87, 0xf9, 0x95, 0xa3, 0xbf, 0xa5, 0xd8, 0x8f, 0x0d, 0x29, 0x76, 0xd4, 0x90, 0xc0, 0x71, 0x43, - 0x02, 0x7f, 0x35, 0x24, 0xf0, 0xe5, 0x89, 0x14, 0x3b, 0x3e, 0x91, 0x62, 0x7f, 0x9e, 0x48, 0xb1, - 0x0f, 0xa7, 0x02, 0x2b, 0xf7, 0xb2, 0x4d, 0x2b, 0x0f, 0x7d, 0x17, 0x86, 0xf6, 0xd8, 0x73, 0xc5, - 0xff, 0x03, 0x2a, 0x26, 0xf8, 0x5f, 0x37, 0xb7, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x05, 0x2c, - 0x06, 0xa6, 0x6a, 0x12, 0x00, 0x00, + // 1332 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0x1f, 0xd3, 0x94, 0x98, 0x69, 0x49, 0x8c, 0x49, 0x77, 0xa3, 0xa5, + 0xa4, 0x69, 0x1a, 0x76, 0x49, 0x9a, 0x50, 0x40, 0x02, 0x14, 0xa7, 0xd0, 0x24, 0x52, 0xa4, 0x74, + 0x2b, 0x54, 0x89, 0x1e, 0xac, 0xb1, 0x77, 0xe2, 0xac, 0x14, 0xef, 0x3a, 0x3b, 0x93, 0xa4, 0x56, + 0x14, 0x40, 0x95, 0xb8, 0x21, 0x7e, 0x08, 0x71, 0x44, 0x70, 0x40, 0x85, 0x33, 0x5c, 0x10, 0x57, + 0x2e, 0x39, 0x46, 0xe2, 0xc2, 0xc9, 0x02, 0x87, 0x03, 0xca, 0x9f, 0xd0, 0x13, 0xda, 0xd9, 0x59, + 0x7b, 0xd7, 0xf6, 0xc6, 0x4e, 0x65, 0x71, 0xb1, 0xf6, 0xc7, 0x9b, 0x79, 0x9f, 0xf7, 0xdd, 0x37, + 0xef, 0x3d, 0x19, 0x4e, 0x94, 0x6c, 0x5a, 0xd9, 0xc7, 0xb4, 0xa2, 0xf1, 0x9f, 0xbd, 0x39, 0x6d, + 0x67, 0x97, 0x38, 0x35, 0xb5, 0xea, 0xd8, 0xcc, 0x46, 0x19, 0xff, 0xad, 0xca, 0x7f, 0xf6, 0xe6, + 0x72, 0x57, 0xca, 0x76, 0xd9, 0xe6, 0x2f, 0x35, 0xf7, 0xca, 0xb3, 0xcb, 0x75, 0xee, 0xc2, 0x6a, + 0x55, 0x42, 0xfd, 0xb7, 0x65, 0xdb, 0x2e, 0x6f, 0x13, 0x0d, 0x57, 0x4d, 0x0d, 0x5b, 0x96, 0xcd, + 0x30, 0x33, 0x6d, 0xcb, 0x7f, 0x3b, 0xe3, 0xae, 0xb5, 0xa9, 0x56, 0xc4, 0x94, 0x78, 0xce, 0xb5, + 0xbd, 0xb9, 0x22, 0x61, 0x78, 0x4e, 0xab, 0xe2, 0xb2, 0x69, 0x71, 0x63, 0xcf, 0x56, 0x59, 0x80, + 0xd9, 0x7b, 0xae, 0xc5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 0x46, 0xf3, 0x35, 0xd7, 0xb7, + 0x2f, 0xdb, 0x38, 0x4c, 0x96, 0x6c, 0x83, 0x14, 0x4c, 0x83, 0xcb, 0x16, 0xd7, 0x13, 0xee, 0xed, + 0xaa, 0x31, 0x30, 0xd5, 0x3e, 0x6d, 0x57, 0xad, 0x09, 0x20, 0x54, 0x9b, 0x80, 0x69, 0xff, 0x6b, + 0x7b, 0xba, 0xa5, 0xf5, 0xd6, 0x83, 0xc1, 0xe9, 0xf0, 0x89, 0xcf, 0xb1, 0xb4, 0xbd, 0xed, 0xa3, + 0xdc, 0x67, 0x98, 0x91, 0xff, 0x2f, 0x81, 0xbe, 0x03, 0xf0, 0x6a, 0x04, 0x82, 0xd0, 0x62, 0x11, + 0x26, 0x2a, 0xb6, 0x41, 0xb6, 0xfd, 0x04, 0x1a, 0xef, 0x4c, 0xa0, 0x75, 0xf7, 0xbd, 0xc8, 0x16, + 0x61, 0x3c, 0x38, 0x91, 0x1e, 0x08, 0x8d, 0x74, 0xbc, 0x7f, 0x4e, 0x8d, 0xae, 0x42, 0xc8, 0x7d, + 0x14, 0x0c, 0xcc, 0x30, 0x47, 0x18, 0xd1, 0xd3, 0xfc, 0xc9, 0x1d, 0xcc, 0xb0, 0x72, 0x4b, 0x44, + 0xde, 0xb9, 0xb1, 0x88, 0x1c, 0xc1, 0x38, 0x5f, 0x09, 0xf8, 0x4a, 0x7e, 0xad, 0xec, 0x40, 0x89, + 0x2f, 0xba, 0x5f, 0xc1, 0x0e, 0x3b, 0x27, 0xcf, 0x62, 0x27, 0x4f, 0x7e, 0xec, 0x69, 0x5d, 0x46, + 0x01, 0x82, 0x75, 0x42, 0xa9, 0xab, 0x44, 0x80, 0x73, 0x1d, 0xca, 0x91, 0x2e, 0x05, 0xe9, 0x4c, + 0x90, 0x34, 0x72, 0x4f, 0x2f, 0x82, 0x9b, 0x30, 0x23, 0x72, 0xbf, 0xf7, 0x89, 0x53, 0xbe, 0x1d, + 0x82, 0x19, 0xd7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86, 0xf6, 0xc8, 0x73, 0xc5, 0xff, 0x03, + 0x2a, 0x26, 0xf8, 0x5f, 0x37, 0xb7, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x28, 0x92, 0x6c, 0x5d, + 0x6a, 0x12, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -2462,6 +2461,18 @@ func (m *QueryContractsByCreatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.CreatorAddress) > 0 { i -= len(m.CreatorAddress) copy(dAtA[i:], m.CreatorAddress) @@ -2492,23 +2503,11 @@ func (m *QueryContractsByCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int _ = i var l int _ = l - if m.Pagination != nil { - { - size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.contractAdress) > 0 { - for iNdEx := len(m.contractAdress) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.contractAdress[iNdEx]) - copy(dAtA[i:], m.contractAdress[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.contractAdress[iNdEx]))) + if len(m.ContractAddress) > 0 { + for iNdEx := len(m.ContractAddress) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ContractAddress[iNdEx]) + copy(dAtA[i:], m.ContractAddress[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress[iNdEx]))) i-- dAtA[i] = 0xa } @@ -2868,6 +2867,10 @@ func (m *QueryContractsByCreatorRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2877,16 +2880,12 @@ func (m *QueryContractsByCreatorResponse) Size() (n int) { } var l int _ = l - if len(m.contractAdress) > 0 { - for _, s := range m.contractAdress { + if len(m.ContractAddress) > 0 { + for _, s := range m.ContractAddress { l = len(s) n += 1 + l + sovQuery(uint64(l)) } } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } return n } @@ -5197,6 +5196,42 @@ func (m *QueryContractsByCreatorRequest) Unmarshal(dAtA []byte) error { } m.CreatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5249,7 +5284,7 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field contractAdress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5277,43 +5312,7 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.contractAdress = append(m.contractAdress, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ContractAddress = append(m.ContractAddress, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/wasm/types/query.pb.gw.go b/x/wasm/types/query.pb.gw.go index a31c70c1fe..865c0ad75f 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -599,6 +599,10 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +var ( + filter_Query_ContractsByCreator_0 = &utilities.DoubleArray{Encoding: map[string]int{"creator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCreatorRequest var metadata runtime.ServerMetadata @@ -621,6 +625,13 @@ func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator_address", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ContractsByCreator_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.ContractsByCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -648,6 +659,13 @@ func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator_address", err) } + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ContractsByCreator_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.ContractsByCreator(ctx, &protoReq) return msg, metadata, err From f324e422f345a24a0c293b7bbe6078b272fc8696 Mon Sep 17 00:00:00 2001 From: vuong Date: Sat, 24 Sep 2022 01:27:18 +0700 Subject: [PATCH 05/35] cli --- x/wasm/client/cli/query.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go index b847b3d843..3aba09099a 100644 --- a/x/wasm/client/cli/query.go +++ b/x/wasm/client/cli/query.go @@ -41,6 +41,7 @@ func GetQueryCmd() *cobra.Command { GetCmdLibVersion(), GetCmdQueryParams(), GetCmdBuildAddress(), + GetCmdListContractsByCreator(), ) return queryCmd } @@ -528,6 +529,36 @@ func GetCmdListPinnedCode() *cobra.Command { return cmd } +// GetCmdContractsByCreator lists all contracts by creator +func GetCmdListContractsByCreator() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-contracts-by-creator [creator]", + Short: "List all contracts by creator", + Long: "\t\tLong: List all contracts by creator,\n", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.ContractsByCreator( + context.Background(), + &types.QueryContractsByCreatorRequest{ + CreatorAddress: args[0], + }, + ) + if err != nil { + return err + } + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + type argumentDecoder struct { // dec is the default decoder dec func(string) ([]byte, error) From 21e5ca4c398ad9d0629013d7c6f6c9e079f2cfe4 Mon Sep 17 00:00:00 2001 From: vuong Date: Sat, 24 Sep 2022 16:34:06 +0700 Subject: [PATCH 06/35] fix test --- x/wasm/keeper/genesis_test.go | 5 +++-- x/wasm/keeper/keeper_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index ea4282b753..b999e7f7f8 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -124,6 +124,7 @@ func TestGenesisExportImport(t *testing.T) { newHistory := x.ResetFromGenesis(dstCtx) wasmKeeper.storeContractInfo(srcCtx, address, x) wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, newHistory) + wasmKeeper.addToContractCreatorThirdIndex(srcCtx, creatorAddress, address) wasmKeeper.appendToContractHistory(srcCtx, address, newHistory) iter.Close() return false @@ -147,8 +148,8 @@ func TestGenesisExportImport(t *testing.T) { dstIT.Next() srcIT.Next() } - if !assert.False(t, dstIT.Valid()) { - t.Fatalf("dest Iterator still has key :%X", dstIT.Key()) + if !assert.False(t, srcIT.Valid()) { + t.Fatalf("dest Iterator still has key :%s", dstIT.Key()) } srcIT.Close() dstIT.Close() diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 947edd27c3..84434a6ad2 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -400,7 +400,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1964f), gasAfter-gasBefore) + require.Equal(t, uint64(0x1a5bd), gasAfter-gasBefore) } // ensure it is stored properly From fa51c0d3ea91a557f6697ac5e1cffa7d57738475 Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 12:44:24 +0700 Subject: [PATCH 07/35] linting --- x/wasm/keeper/keeper.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 62f61e5e03..11f95458b0 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -491,7 +491,9 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) } creatorAddress, err := sdk.AccAddressFromBech32(contractInfo.Creator) - + if err != nil { + return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) + } // delete old secondary index entry k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.getLastContractHistoryEntry(ctx, contractAddress)) k.removeFromContractCreatorThirdIndex(ctx, creatorAddress, contractAddress) From f856dc398b2d65a5a92b6fd8a1e296d4f030884a Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 14:30:11 +0700 Subject: [PATCH 08/35] add key test --- x/wasm/types/keys_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/x/wasm/types/keys_test.go b/x/wasm/types/keys_test.go index 552703fea0..a9ac3fae7b 100644 --- a/x/wasm/types/keys_test.go +++ b/x/wasm/types/keys_test.go @@ -85,3 +85,33 @@ func TestGetContractByCreatedSecondaryIndexKey(t *testing.T) { } assert.Equal(t, exp, got) } + +func TestGetContractByCreatorThirdIndexKey(t *testing.T) { + creatorAddr := bytes.Repeat([]byte{4}, 20) + + // test that contract addresses of 20 length are still supported + contractAddr := bytes.Repeat([]byte{4}, 20) + got := GetContractByCreatorThirdIndexKey(creatorAddr, contractAddr) + exp := []byte{ + 9, // prefix + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 20 bytes + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + } + assert.Equal(t, exp, got) + + // test that contract addresses of 32 length are still supported + contractAddr = bytes.Repeat([]byte{4}, 32) + got = GetContractByCreatorThirdIndexKey(creatorAddr, contractAddr) + exp = []byte{ + 9, // prefix + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 32 bytes + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, + } + assert.Equal(t, exp, got) +} From be53b486b92973108b35fa76caa368d1721e23fa Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 14:30:17 +0700 Subject: [PATCH 09/35] no need to change creator when migrate --- x/wasm/keeper/keeper.go | 12 +++--------- x/wasm/types/keys.go | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 11f95458b0..ac0c328db9 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -490,18 +490,12 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller if err != nil { return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) } - creatorAddress, err := sdk.AccAddressFromBech32(contractInfo.Creator) - if err != nil { - return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) - } // delete old secondary index entry k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.getLastContractHistoryEntry(ctx, contractAddress)) - k.removeFromContractCreatorThirdIndex(ctx, creatorAddress, contractAddress) // persist migration updates historyEntry := contractInfo.AddMigration(ctx, newCodeID, msg) k.appendToContractHistory(ctx, contractAddress, historyEntry) k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) - k.addToContractCreatorThirdIndex(ctx, creatorAddress, contractAddress) k.storeContractInfo(ctx, contractAddress, contractInfo) ctx.EventManager().EmitEvent(sdk.NewEvent( @@ -605,15 +599,15 @@ func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAd // addToContractCreatorThirdIndex adds element to the index for contracts-by-creator queries func (k Keeper) addToContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractByCreatorThirdIndexPrefix(creatorAddress, contractAddress), []byte{}) + store.Set(types.GetContractByCreatorThirdIndexKey(creatorAddress, contractAddress), []byte{}) } // removeFromContractCodeSecondaryIndex removes element to the index for contracts-by-creator queries func (k Keeper) removeFromContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { - ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatorThirdIndexPrefix(creatorAddress, contractAddress)) + ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatorThirdIndexKey(creatorAddress, contractAddress)) } -// IterateContractsByCode iterates over all contracts with given creator address. +// IterateContractsByCreator iterates over all contracts with given creator address. func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index e49ac089dc..b212475a61 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -81,8 +81,8 @@ func GetContractByCodeIDSecondaryIndexPrefix(codeID uint64) []byte { return r } -// GetContractByCodeIDSecondaryIndexPrefix returns the prefix for the second index: `` -func GetContractByCreatorThirdIndexPrefix(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { +// GetContractByCreatorThirdIndexKey returns the key for the second index: `` +func GetContractByCreatorThirdIndexKey(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { prefixBytes := GetContractsByCreatorPrefix(addr) return append(prefixBytes, contractAddr...) } From 94c0dbfa2f833877e81dfd9f5d1cb4eebea62676 Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 15:06:30 +0700 Subject: [PATCH 10/35] add query test --- x/wasm/keeper/querier_test.go | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index f4341d169d..26d4634eff 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -802,6 +802,62 @@ func TestQueryCodeInfoList(t *testing.T) { require.EqualValues(t, allCodesResponse, got.CodeInfos) } +func TestQueryContractsByCreatorList(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + keeper := keepers.WasmKeeper + + deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000)) + topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 500)) + creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...) + anyAddr := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...) + + wasmCode, err := os.ReadFile("./testdata/hackatom.wasm") + require.NoError(t, err) + + codeID, _, err := keepers.ContractKeeper.Create(ctx, creator, wasmCode, nil) + require.NoError(t, err) + + _, _, bob := keyPubAddr() + initMsg := HackatomExampleInitMsg{ + Verifier: anyAddr, + Beneficiary: bob, + } + initMsgBz, err := json.Marshal(initMsg) + require.NoError(t, err) + + // manage some realistic block settings + var h int64 = 10 + setBlock := func(ctx sdk.Context, height int64) sdk.Context { + ctx = ctx.WithBlockHeight(height) + meter := sdk.NewGasMeter(1000000) + ctx = ctx.WithGasMeter(meter) + ctx = ctx.WithBlockGasMeter(meter) + return ctx + } + + // create 15 contracts with real block/gas setup + for i := 0; i < 15; i++ { + // 3 tx per block, so we ensure both comparisons work + if i%3 == 0 { + ctx = setBlock(ctx, h) + h++ + } + _, _, err = keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, initMsgBz, fmt.Sprintf("contract %d", i), topUp) + require.NoError(t, err) + } + + // query and check the results are properly sorted + q := Querier(keeper) + res, err := q.ContractsByCreator(sdk.WrapSDKContext(ctx), &types.QueryContractsByCreatorRequest{CreatorAddress: creator.String()}) + require.NoError(t, err) + + require.Equal(t, 15, len(res.ContractAddress)) + + for _, contractAddr := range res.ContractAddress { + assert.NotEmpty(t, contractAddr) + } +} + func fromBase64(s string) []byte { r, err := base64.StdEncoding.DecodeString(s) if err != nil { From e0a738408deb1fe0f0859a476032d3b9f5e52282 Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 15:17:43 +0700 Subject: [PATCH 11/35] minor --- x/wasm/keeper/genesis_test.go | 1 - x/wasm/keeper/keeper.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index b999e7f7f8..c775b724a7 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -112,7 +112,6 @@ func TestGenesisExportImport(t *testing.T) { wasmKeeper.IterateContractInfo(srcCtx, func(address sdk.AccAddress, info wasmTypes.ContractInfo) bool { creatorAddress, _ := sdk.AccAddressFromBech32(info.Creator) wasmKeeper.removeFromContractCodeSecondaryIndex(srcCtx, address, wasmKeeper.getLastContractHistoryEntry(srcCtx, address)) - wasmKeeper.removeFromContractCreatorThirdIndex(srcCtx, creatorAddress, address) prefixStore := prefix.NewStore(srcCtx.KVStore(wasmKeeper.storeKey), types.GetContractCodeHistoryElementPrefix(address)) iter := prefixStore.Iterator(nil, nil) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index ac0c328db9..7703c156bb 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -603,9 +603,9 @@ func (k Keeper) addToContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, } // removeFromContractCodeSecondaryIndex removes element to the index for contracts-by-creator queries -func (k Keeper) removeFromContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { - ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatorThirdIndexKey(creatorAddress, contractAddress)) -} +// func (k Keeper) removeFromContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { +// ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatorThirdIndexKey(creatorAddress, contractAddress)) +// } // IterateContractsByCreator iterates over all contracts with given creator address. func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { From 46b58b7d457f00f142bd0636df25501504918202 Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 16:06:22 +0700 Subject: [PATCH 12/35] add migrate logic --- x/wasm/keeper/keeper.go | 11 +++++++++++ x/wasm/keeper/migrations.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 x/wasm/keeper/migrations.go diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 7703c156bb..8751b26dab 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -618,6 +618,17 @@ func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddres } } +// IterateAllContract iterates over all contracts. +func (k Keeper) IterateAllContract(ctx sdk.Context, cb func(address sdk.AccAddress) bool) { + prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ContractKeyPrefix) + for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { + key := iter.Key() + if cb(key[types.AbsoluteTxPositionLen:]) { + return + } + } +} + // IterateContractsByCode iterates over all contracts with given codeID ASC on code update time. func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool) { prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractByCodeIDSecondaryIndexPrefix(codeID)) diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go new file mode 100644 index 0000000000..9b99137486 --- /dev/null +++ b/x/wasm/keeper/migrations.go @@ -0,0 +1,37 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +// Migrate2to3 migrates from version 2 to 3. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + var allContract []string + m.keeper.IterateAllContract(ctx, func(addr sdk.AccAddress) bool { + allContract = append(allContract, addr.String()) + return false + }) + for _, contract := range allContract { + contractAddress, err := sdk.AccAddressFromBech32(contract) + if err != nil { + return err + } + contractInfo := m.keeper.GetContractInfo(ctx, contractAddress) + creator, err := sdk.AccAddressFromBech32(contractInfo.Creator) + if err != nil { + return err + } + m.keeper.addToContractCreatorThirdIndex(ctx, creator, contractAddress) + } + return nil +} From f4cfbe86925464f14b4e9302bd0ea07224d6702e Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 17:26:13 +0700 Subject: [PATCH 13/35] add more test --- x/wasm/keeper/keeper.go | 6 +++--- x/wasm/keeper/keeper_test.go | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 8751b26dab..92195182b3 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -612,7 +612,7 @@ func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddres prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { key := iter.Key() - if cb(key[types.AbsoluteTxPositionLen:]) { + if cb(key) { return } } @@ -620,10 +620,10 @@ func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddres // IterateAllContract iterates over all contracts. func (k Keeper) IterateAllContract(ctx sdk.Context, cb func(address sdk.AccAddress) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ContractKeyPrefix) + prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ContractByCodeIDAndCreatedSecondaryIndexPrefix) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { key := iter.Key() - if cb(key[types.AbsoluteTxPositionLen:]) { + if cb(key[24:]) { return } } diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 84434a6ad2..d2031bb442 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -2188,3 +2188,41 @@ func TestCoinBurnerPruneBalances(t *testing.T) { }) } } + +func TestIteratorAllContract(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + example1 := InstantiateHackatomExampleContract(t, ctx, keepers) + example2 := InstantiateHackatomExampleContract(t, ctx, keepers) + example3 := InstantiateHackatomExampleContract(t, ctx, keepers) + example4 := InstantiateHackatomExampleContract(t, ctx, keepers) + + var allContract []string + keepers.WasmKeeper.IterateAllContract(ctx, func(addr sdk.AccAddress) bool { + allContract = append(allContract, addr.String()) + return false + }) + require.Equal(t, + allContract, + []string{ + example1.Contract.String(), + example2.Contract.String(), + example3.Contract.String(), + example4.Contract.String(), + }) +} + +func TestIteratorContractByCreator(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + example1 := InstantiateHackatomExampleContract(t, ctx, keepers) + + var allContract []string + keepers.WasmKeeper.IterateContractsByCreator(ctx, example1.CreatorAddr, func(addr sdk.AccAddress) bool { + allContract = append(allContract, addr.String()) + return false + }) + require.Equal(t, + allContract, + []string{ + example1.Contract.String(), + }) +} From c8719151c20ed4fc9dcde47316496ca075814cce Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 17:44:58 +0700 Subject: [PATCH 14/35] register migration --- x/wasm/module.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/x/wasm/module.go b/x/wasm/module.go index c7ea6339c0..5bee3bbc17 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -134,6 +134,12 @@ func NewAppModule( func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(keeper.NewDefaultPermissionKeeper(am.keeper))) types.RegisterQueryServer(cfg.QueryServer(), NewQuerier(am.keeper)) + + m := keeper.NewMigrator(*am.keeper) + err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + if err != nil { + panic(err) + } } func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { //nolint:staticcheck From 6bfeb161e9d78093c5d8712cc43a4189ffe2e54e Mon Sep 17 00:00:00 2001 From: vuong Date: Sun, 25 Sep 2022 17:48:16 +0700 Subject: [PATCH 15/35] minor --- x/wasm/keeper/genesis_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index c775b724a7..6ffb751ca4 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -147,7 +147,7 @@ func TestGenesisExportImport(t *testing.T) { dstIT.Next() srcIT.Next() } - if !assert.False(t, srcIT.Valid()) { + if !assert.False(t, dstIT.Valid()) { t.Fatalf("dest Iterator still has key :%s", dstIT.Key()) } srcIT.Close() From 86692b57173be809c807e12c308bc7dec0343f84 Mon Sep 17 00:00:00 2001 From: vuong <56973102+vuong177@users.noreply.github.com> Date: Tue, 27 Sep 2022 18:12:10 +0700 Subject: [PATCH 16/35] Update x/wasm/client/cli/query.go Co-authored-by: Alexander Peters --- x/wasm/client/cli/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go index 3aba09099a..b7c8687699 100644 --- a/x/wasm/client/cli/query.go +++ b/x/wasm/client/cli/query.go @@ -529,7 +529,7 @@ func GetCmdListPinnedCode() *cobra.Command { return cmd } -// GetCmdContractsByCreator lists all contracts by creator +// GetCmdListContractsByCreator lists all contracts by creator func GetCmdListContractsByCreator() *cobra.Command { cmd := &cobra.Command{ Use: "list-contracts-by-creator [creator]", From ffbbdf132ee65edbb1687615db2f69391a73a30f Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 27 Sep 2022 18:51:50 +0700 Subject: [PATCH 17/35] nits --- x/wasm/keeper/genesis_test.go | 2 +- x/wasm/keeper/keeper.go | 26 +++++--------------------- x/wasm/types/keys.go | 4 ++-- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index 6ffb751ca4..bf87137d11 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -123,7 +123,7 @@ func TestGenesisExportImport(t *testing.T) { newHistory := x.ResetFromGenesis(dstCtx) wasmKeeper.storeContractInfo(srcCtx, address, x) wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, newHistory) - wasmKeeper.addToContractCreatorThirdIndex(srcCtx, creatorAddress, address) + wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, address) wasmKeeper.appendToContractHistory(srcCtx, address, newHistory) iter.Close() return false diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 92195182b3..f4d09dcd45 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -378,7 +378,7 @@ func (k Keeper) instantiate( // store contract before dispatch so that contract could be called back historyEntry := contractInfo.InitialHistory(initMsg) k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) - k.addToContractCreatorThirdIndex(ctx, creator, contractAddress) + k.addToContractCreatorSecondaryIndex(ctx, creator, contractAddress) k.appendToContractHistory(ctx, contractAddress, historyEntry) k.storeContractInfo(ctx, contractAddress, &contractInfo) @@ -596,17 +596,12 @@ func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAd ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatedSecondaryIndexKey(contractAddress, entry)) } -// addToContractCreatorThirdIndex adds element to the index for contracts-by-creator queries -func (k Keeper) addToContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { +// addToContractCreatorSecondaryIndex adds element to the index for contracts-by-creator queries +func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractByCreatorThirdIndexKey(creatorAddress, contractAddress), []byte{}) + store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, contractAddress), []byte{}) } -// removeFromContractCodeSecondaryIndex removes element to the index for contracts-by-creator queries -// func (k Keeper) removeFromContractCreatorThirdIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { -// ctx.KVStore(k.storeKey).Delete(types.GetContractByCreatorThirdIndexKey(creatorAddress, contractAddress)) -// } - // IterateContractsByCreator iterates over all contracts with given creator address. func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) @@ -618,17 +613,6 @@ func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddres } } -// IterateAllContract iterates over all contracts. -func (k Keeper) IterateAllContract(ctx sdk.Context, cb func(address sdk.AccAddress) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.ContractByCodeIDAndCreatedSecondaryIndexPrefix) - for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { - key := iter.Key() - if cb(key[24:]) { - return - } - } -} - // IterateContractsByCode iterates over all contracts with given codeID ASC on code update time. func (k Keeper) IterateContractsByCode(ctx sdk.Context, codeID uint64, cb func(address sdk.AccAddress) bool) { prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractByCodeIDSecondaryIndexPrefix(codeID)) @@ -1092,7 +1076,7 @@ func (k Keeper) importContract(ctx sdk.Context, contractAddr sdk.AccAddress, c * k.appendToContractHistory(ctx, contractAddr, historyEntry) k.storeContractInfo(ctx, contractAddr, c) k.addToContractCodeSecondaryIndex(ctx, contractAddr, historyEntry) - k.addToContractCreatorThirdIndex(ctx, creatorAddress, contractAddr) + k.addToContractCreatorSecondaryIndex(ctx, creatorAddress, contractAddr) return k.importContractState(ctx, contractAddr, state) } diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index b212475a61..f3173d8e86 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -81,8 +81,8 @@ func GetContractByCodeIDSecondaryIndexPrefix(codeID uint64) []byte { return r } -// GetContractByCreatorThirdIndexKey returns the key for the second index: `` -func GetContractByCreatorThirdIndexKey(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { +// GetContractByCreatorSecondaryIndexKey returns the key for the second index: `` +func GetContractByCreatorSecondaryIndexKey(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { prefixBytes := GetContractsByCreatorPrefix(addr) return append(prefixBytes, contractAddr...) } From fd757f220cac21e44027dbf1aa507b5a7f75e02e Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 27 Sep 2022 18:52:11 +0700 Subject: [PATCH 18/35] remove IterateAllContract --- x/wasm/keeper/keeper_test.go | 14 +++++--------- x/wasm/keeper/migrations.go | 5 +++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index d2031bb442..886862cb33 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -2197,18 +2197,14 @@ func TestIteratorAllContract(t *testing.T) { example4 := InstantiateHackatomExampleContract(t, ctx, keepers) var allContract []string - keepers.WasmKeeper.IterateAllContract(ctx, func(addr sdk.AccAddress) bool { + keepers.WasmKeeper.IterateContractInfo(ctx, func(addr sdk.AccAddress, _ types.ContractInfo) bool { allContract = append(allContract, addr.String()) return false }) - require.Equal(t, - allContract, - []string{ - example1.Contract.String(), - example2.Contract.String(), - example3.Contract.String(), - example4.Contract.String(), - }) + require.Contains(t, allContract, example1.Contract.String()) + require.Contains(t, allContract, example2.Contract.String()) + require.Contains(t, allContract, example3.Contract.String()) + require.Contains(t, allContract, example4.Contract.String()) } func TestIteratorContractByCreator(t *testing.T) { diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go index 9b99137486..f044eb639c 100644 --- a/x/wasm/keeper/migrations.go +++ b/x/wasm/keeper/migrations.go @@ -1,6 +1,7 @@ package keeper import ( + "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -17,7 +18,7 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate2to3 migrates from version 2 to 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { var allContract []string - m.keeper.IterateAllContract(ctx, func(addr sdk.AccAddress) bool { + m.keeper.IterateContractInfo(ctx, func(addr sdk.AccAddress, _ types.ContractInfo) bool { allContract = append(allContract, addr.String()) return false }) @@ -31,7 +32,7 @@ func (m Migrator) Migrate2to3(ctx sdk.Context) error { if err != nil { return err } - m.keeper.addToContractCreatorThirdIndex(ctx, creator, contractAddress) + m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractAddress) } return nil } From a8c9e34cb4160fbbb8c4c752bf5185d1df7963f7 Mon Sep 17 00:00:00 2001 From: vuong <56973102+vuong177@users.noreply.github.com> Date: Tue, 27 Sep 2022 18:57:03 +0700 Subject: [PATCH 19/35] Update x/wasm/keeper/genesis_test.go Co-authored-by: Alexander Peters --- x/wasm/keeper/genesis_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index bf87137d11..32831c6593 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -110,7 +110,7 @@ func TestGenesisExportImport(t *testing.T) { // reset contract code index in source DB for comparison with dest DB wasmKeeper.IterateContractInfo(srcCtx, func(address sdk.AccAddress, info wasmTypes.ContractInfo) bool { - creatorAddress, _ := sdk.AccAddressFromBech32(info.Creator) + creatorAddress := sdk.MustAccAddressFromBech32(info.Creator) wasmKeeper.removeFromContractCodeSecondaryIndex(srcCtx, address, wasmKeeper.getLastContractHistoryEntry(srcCtx, address)) prefixStore := prefix.NewStore(srcCtx.KVStore(wasmKeeper.storeKey), types.GetContractCodeHistoryElementPrefix(address)) From 54f157da77b079b096cfab490a1a681d81b74ec5 Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 27 Sep 2022 18:57:42 +0700 Subject: [PATCH 20/35] nit --- x/wasm/keeper/genesis_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index 32831c6593..1cfe9d9a0d 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -148,7 +148,7 @@ func TestGenesisExportImport(t *testing.T) { srcIT.Next() } if !assert.False(t, dstIT.Valid()) { - t.Fatalf("dest Iterator still has key :%s", dstIT.Key()) + t.Fatalf("dest Iterator still has key :%X", dstIT.Key()) } srcIT.Close() dstIT.Close() From df069948a5edd27b1f7532b216319eaa590b5af3 Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 27 Sep 2022 19:02:43 +0700 Subject: [PATCH 21/35] nit: func name --- x/wasm/types/keys_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/wasm/types/keys_test.go b/x/wasm/types/keys_test.go index a9ac3fae7b..b089301f21 100644 --- a/x/wasm/types/keys_test.go +++ b/x/wasm/types/keys_test.go @@ -86,12 +86,12 @@ func TestGetContractByCreatedSecondaryIndexKey(t *testing.T) { assert.Equal(t, exp, got) } -func TestGetContractByCreatorThirdIndexKey(t *testing.T) { +func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { creatorAddr := bytes.Repeat([]byte{4}, 20) // test that contract addresses of 20 length are still supported contractAddr := bytes.Repeat([]byte{4}, 20) - got := GetContractByCreatorThirdIndexKey(creatorAddr, contractAddr) + got := GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) exp := []byte{ 9, // prefix 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address @@ -103,7 +103,7 @@ func TestGetContractByCreatorThirdIndexKey(t *testing.T) { // test that contract addresses of 32 length are still supported contractAddr = bytes.Repeat([]byte{4}, 32) - got = GetContractByCreatorThirdIndexKey(creatorAddr, contractAddr) + got = GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) exp = []byte{ 9, // prefix 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address From 93e79f58edb2b227e4a595dd5d8cb94be897caee Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 27 Sep 2022 23:33:18 +0700 Subject: [PATCH 22/35] change key --- x/wasm/keeper/keeper.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index f4d09dcd45..fe0b658229 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -19,6 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" @@ -599,12 +600,14 @@ func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAd // addToContractCreatorSecondaryIndex adds element to the index for contracts-by-creator queries func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, contractAddress), []byte{}) + bz := address.MustLengthPrefix(creatorAddress) + store.Set(types.GetContractByCreatorSecondaryIndexKey(bz, contractAddress), []byte{}) } // IterateContractsByCreator iterates over all contracts with given creator address. func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) + bz := address.MustLengthPrefix(creator) + prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(bz)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { key := iter.Key() if cb(key) { From 2b732cf108eac7572f7f5f794def9894e63b1be9 Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 27 Sep 2022 23:33:36 +0700 Subject: [PATCH 23/35] improve TestIteratorContractByCreator --- x/wasm/keeper/keeper_test.go | 66 ++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 886862cb33..1a610574d5 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -2208,17 +2208,61 @@ func TestIteratorAllContract(t *testing.T) { } func TestIteratorContractByCreator(t *testing.T) { - ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) - example1 := InstantiateHackatomExampleContract(t, ctx, keepers) + // setup test + parentCtx, keepers := CreateTestInput(t, false, AvailableCapabilities) + keeper := keepers.ContractKeeper - var allContract []string - keepers.WasmKeeper.IterateContractsByCreator(ctx, example1.CreatorAddr, func(addr sdk.AccAddress) bool { - allContract = append(allContract, addr.String()) - return false - }) - require.Equal(t, - allContract, - []string{ - example1.Contract.String(), + depositFund := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000)) + topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) + creator := DeterministicAccountAddress(t, 1) + keepers.Faucet.Fund(parentCtx, creator, depositFund.Add(depositFund...)...) + mockAddress1 := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) + mockAddress2 := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) + + originalContractID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil) + require.NoError(t, err) + + initMsgBz := HackatomExampleInitMsg{ + Verifier: mockAddress1, + Beneficiary: mockAddress1, + }.GetBytes(t) + + depositContract := sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))) + + gotAddr1, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, mockAddress1, nil, initMsgBz, "label", depositContract) + gotAddr2, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, mockAddress2, nil, initMsgBz, "label", depositContract) + gotAddr3, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, mockAddress1, nil, initMsgBz, "label", depositContract) + gotAddr4, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, gotAddr1, nil, initMsgBz, "label", depositContract) + + specs := map[string]struct { + creatorAddr sdk.AccAddress + contractsAddr []string + }{ + "mockAddres1": { + creatorAddr: mockAddress1, + contractsAddr: []string{gotAddr3.String(), gotAddr1.String()}, + }, + "mockAddres2": { + creatorAddr: mockAddress2, + contractsAddr: []string{gotAddr2.String()}, + }, + "contractAdress": { + creatorAddr: gotAddr1, + contractsAddr: []string{gotAddr4.String()}, + }, + } + + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + var allContract []string + keepers.WasmKeeper.IterateContractsByCreator(parentCtx, spec.creatorAddr, func(addr sdk.AccAddress) bool { + allContract = append(allContract, addr.String()) + return false + }) + require.Equal(t, + allContract, + spec.contractsAddr, + ) }) + } } From 79d6ff6627a2c7b071b9b1cbe889733ee86f6226 Mon Sep 17 00:00:00 2001 From: vuong Date: Wed, 28 Sep 2022 01:15:55 +0700 Subject: [PATCH 24/35] fix test --- x/wasm/keeper/keeper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 1a610574d5..5c5ad0a476 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -400,7 +400,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1a5bd), gasAfter-gasBefore) + require.Equal(t, uint64(0x1a5db), gasAfter-gasBefore) } // ensure it is stored properly From 0a800f6bf5cdae5793c287dda95ec7247dac24a1 Mon Sep 17 00:00:00 2001 From: vuong Date: Wed, 28 Sep 2022 14:45:51 +0700 Subject: [PATCH 25/35] use IterateContractInfo in migrate2to3 --- x/wasm/keeper/migrations.go | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go index f044eb639c..71783d0118 100644 --- a/x/wasm/keeper/migrations.go +++ b/x/wasm/keeper/migrations.go @@ -17,22 +17,10 @@ func NewMigrator(keeper Keeper) Migrator { // Migrate2to3 migrates from version 2 to 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { - var allContract []string - m.keeper.IterateContractInfo(ctx, func(addr sdk.AccAddress, _ types.ContractInfo) bool { - allContract = append(allContract, addr.String()) + m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool { + creator := sdk.MustAccAddressFromBech32(contractInfo.Creator) + m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractAddr) return false }) - for _, contract := range allContract { - contractAddress, err := sdk.AccAddressFromBech32(contract) - if err != nil { - return err - } - contractInfo := m.keeper.GetContractInfo(ctx, contractAddress) - creator, err := sdk.AccAddressFromBech32(contractInfo.Creator) - if err != nil { - return err - } - m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractAddress) - } return nil } From 86e2f545102e094de24b0cb5270c58c6f9826d97 Mon Sep 17 00:00:00 2001 From: vuong Date: Wed, 28 Sep 2022 14:56:06 +0700 Subject: [PATCH 26/35] minor --- x/wasm/keeper/keeper.go | 3 +-- x/wasm/types/keys.go | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index fe0b658229..b3c0deb0e9 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -600,8 +600,7 @@ func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAd // addToContractCreatorSecondaryIndex adds element to the index for contracts-by-creator queries func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - bz := address.MustLengthPrefix(creatorAddress) - store.Set(types.GetContractByCreatorSecondaryIndexKey(bz, contractAddress), []byte{}) + store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, contractAddress), []byte{}) } // IterateContractsByCreator iterates over all contracts with given creator address. diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index f3173d8e86..9c572497d3 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -2,6 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" ) const ( @@ -83,7 +84,8 @@ func GetContractByCodeIDSecondaryIndexPrefix(codeID uint64) []byte { // GetContractByCreatorSecondaryIndexKey returns the key for the second index: `` func GetContractByCreatorSecondaryIndexKey(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { - prefixBytes := GetContractsByCreatorPrefix(addr) + bz := address.MustLengthPrefix(addr) + prefixBytes := GetContractsByCreatorPrefix(bz) return append(prefixBytes, contractAddr...) } From 247487fe6e79b5aa3dce3be827b50ab300d24a08 Mon Sep 17 00:00:00 2001 From: vuong Date: Wed, 28 Sep 2022 15:09:31 +0700 Subject: [PATCH 27/35] move key --- x/wasm/keeper/keeper.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index b3c0deb0e9..f4d09dcd45 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -19,7 +19,6 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestingexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" @@ -605,8 +604,7 @@ func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddre // IterateContractsByCreator iterates over all contracts with given creator address. func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { - bz := address.MustLengthPrefix(creator) - prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(bz)) + prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { key := iter.Key() if cb(key) { From f9a53f2378fb07f36bbfa6abbd78dc7e6b442f7a Mon Sep 17 00:00:00 2001 From: vuong Date: Wed, 28 Sep 2022 18:57:40 +0700 Subject: [PATCH 28/35] improve test case --- x/wasm/keeper/keeper_test.go | 36 ++++++++++++++++++++++-------------- x/wasm/types/keys.go | 8 ++++---- x/wasm/types/keys_test.go | 24 ++++++++++++++++++++++-- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 5c5ad0a476..78aba05d6f 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -2201,10 +2201,10 @@ func TestIteratorAllContract(t *testing.T) { allContract = append(allContract, addr.String()) return false }) - require.Contains(t, allContract, example1.Contract.String()) - require.Contains(t, allContract, example2.Contract.String()) - require.Contains(t, allContract, example3.Contract.String()) - require.Contains(t, allContract, example4.Contract.String()) + + // IterateContractInfo not ordering + expContracts := []string{example4.Contract.String(), example2.Contract.String(), example1.Contract.String(), example3.Contract.String()} + require.Equal(t, allContract, expContracts) } func TestIteratorContractByCreator(t *testing.T) { @@ -2218,8 +2218,11 @@ func TestIteratorContractByCreator(t *testing.T) { keepers.Faucet.Fund(parentCtx, creator, depositFund.Add(depositFund...)...) mockAddress1 := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) mockAddress2 := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) + mockAddress3 := keepers.Faucet.NewFundedRandomAccount(parentCtx, topUp...) + + contract1ID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil) + contract2ID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil) - originalContractID, _, err := keeper.Create(parentCtx, creator, hackatomWasm, nil) require.NoError(t, err) initMsgBz := HackatomExampleInitMsg{ @@ -2229,26 +2232,31 @@ func TestIteratorContractByCreator(t *testing.T) { depositContract := sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))) - gotAddr1, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, mockAddress1, nil, initMsgBz, "label", depositContract) - gotAddr2, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, mockAddress2, nil, initMsgBz, "label", depositContract) - gotAddr3, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, mockAddress1, nil, initMsgBz, "label", depositContract) - gotAddr4, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, originalContractID, gotAddr1, nil, initMsgBz, "label", depositContract) + gotAddr1, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, mockAddress1, nil, initMsgBz, "label", depositContract) + gotAddr2, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, mockAddress2, nil, initMsgBz, "label", depositContract) + gotAddr3, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, gotAddr1, nil, initMsgBz, "label", depositContract) + gotAddr4, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract2ID, mockAddress2, nil, initMsgBz, "label", depositContract) + gotAddr5, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract2ID, mockAddress2, nil, initMsgBz, "label", depositContract) specs := map[string]struct { creatorAddr sdk.AccAddress contractsAddr []string }{ - "mockAddres1": { + "single contract": { creatorAddr: mockAddress1, - contractsAddr: []string{gotAddr3.String(), gotAddr1.String()}, + contractsAddr: []string{gotAddr1.String()}, }, - "mockAddres2": { + "muliple contracts": { creatorAddr: mockAddress2, - contractsAddr: []string{gotAddr2.String()}, + contractsAddr: []string{gotAddr2.String(), gotAddr5.String(), gotAddr4.String()}, }, "contractAdress": { creatorAddr: gotAddr1, - contractsAddr: []string{gotAddr4.String()}, + contractsAddr: []string{gotAddr3.String()}, + }, + "no contracts- unknown": { + creatorAddr: mockAddress3, + contractsAddr: nil, }, } diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index 9c572497d3..b7e0b9ff37 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -51,7 +51,8 @@ func GetContractAddressKey(addr sdk.AccAddress) []byte { // GetContractsByCreatorPrefix returns the contracts by creator prefix for the WASM contract instance func GetContractsByCreatorPrefix(addr sdk.AccAddress) []byte { - return append(ContractsByCreatorPrefix, addr...) + bz := address.MustLengthPrefix(addr) + return append(ContractsByCreatorPrefix, bz...) } // GetContractStorePrefix returns the store prefix for the WASM contract instance @@ -82,9 +83,8 @@ func GetContractByCodeIDSecondaryIndexPrefix(codeID uint64) []byte { return r } -// GetContractByCreatorSecondaryIndexKey returns the key for the second index: `` -func GetContractByCreatorSecondaryIndexKey(addr sdk.AccAddress, contractAddr sdk.AccAddress) []byte { - bz := address.MustLengthPrefix(addr) +// GetContractByCreatorSecondaryIndexKey returns the key for the second index: `` +func GetContractByCreatorSecondaryIndexKey(bz []byte, contractAddr sdk.AccAddress) []byte { prefixBytes := GetContractsByCreatorPrefix(bz) return append(prefixBytes, contractAddr...) } diff --git a/x/wasm/types/keys_test.go b/x/wasm/types/keys_test.go index b089301f21..dcc08dba70 100644 --- a/x/wasm/types/keys_test.go +++ b/x/wasm/types/keys_test.go @@ -94,7 +94,8 @@ func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { got := GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) exp := []byte{ 9, // prefix - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address + 20, // creator address length + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address with fixed length prefix 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 20 bytes 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -106,12 +107,31 @@ func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { got = GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) exp = []byte{ 9, // prefix - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address + 20, // creator address length + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address with fixed length prefix 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 32 bytes 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, } + + // test that creator is contract addresses of 32 length + contractAddr = bytes.Repeat([]byte{4}, 32) + creatorAddr = bytes.Repeat([]byte{8}, 32) + got = GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) + exp = []byte{ + 9, // prefix + 32, // creator address length + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // creator address is a contract address + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, + + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 32 bytes + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, + } assert.Equal(t, exp, got) } From c4136b52c172063f6aeeb275695e5fdf68e42421 Mon Sep 17 00:00:00 2001 From: vuong Date: Wed, 28 Sep 2022 20:24:56 +0700 Subject: [PATCH 29/35] add pagReq in ContractsByCreator query --- proto/cosmwasm/wasm/v1/query.proto | 5 +- x/wasm/client/cli/query.go | 9 ++ x/wasm/keeper/querier.go | 11 +- x/wasm/keeper/querier_test.go | 24 ++- x/wasm/types/query.pb.go | 229 ++++++++++++++++++----------- 5 files changed, 179 insertions(+), 99 deletions(-) diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index 6fcc2189b4..354165c738 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -245,11 +245,14 @@ message QueryParamsResponse { message QueryContractsByCreatorRequest { // address is the address of creator string creator_address = 1; + // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; - } message QueryContractsByCreatorResponse { repeated string contract_address = 1 [ (gogoproto.customname) = "ContractAddress" ]; + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; + } \ No newline at end of file diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go index b7c8687699..8d13a1192a 100644 --- a/x/wasm/client/cli/query.go +++ b/x/wasm/client/cli/query.go @@ -541,12 +541,21 @@ func GetCmdListContractsByCreator() *cobra.Command { if err != nil { return err } + _, err = sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + pageReq, err := client.ReadPageRequest(withPageKeyDecoded(cmd.Flags())) + if err != nil { + return err + } queryClient := types.NewQueryClient(clientCtx) res, err := queryClient.ContractsByCreator( context.Background(), &types.QueryContractsByCreatorRequest{ CreatorAddress: args[0], + Pagination: pageReq, }, ) if err != nil { diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index b225fe1dee..f3a4e171d7 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -330,12 +330,17 @@ func (q grpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContr if err != nil { return nil, err } - q.keeper.IterateContractsByCreator(ctx, creatorAddress, func(addr sdk.AccAddress) bool { - contracts = append(contracts, addr.String()) - return false + prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.GetContractsByCreatorPrefix(creatorAddress)) + pageRes, err := query.FilteredPaginate(prefixStore, req.Pagination, func(key []byte, _ []byte, accumulate bool) (bool, error) { + if accumulate { + accAddres := sdk.AccAddress(key) + contracts = append(contracts, accAddres.String()) + } + return true, nil }) return &types.QueryContractsByCreatorResponse{ ContractAddress: contracts, + Pagination: pageRes, }, nil } diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 26d4634eff..98c554be38 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "os" + "sort" "testing" "time" @@ -835,27 +836,34 @@ func TestQueryContractsByCreatorList(t *testing.T) { return ctx } - // create 15 contracts with real block/gas setup - for i := 0; i < 15; i++ { + var expectedContractsAddr []string + // create 50 contracts with real block/gas setup + for i := 0; i < 50; i++ { // 3 tx per block, so we ensure both comparisons work if i%3 == 0 { ctx = setBlock(ctx, h) h++ } - _, _, err = keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, initMsgBz, fmt.Sprintf("contract %d", i), topUp) + contract, _, err := keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, initMsgBz, fmt.Sprintf("contract %d", i), topUp) + expectedContractsAddr = append(expectedContractsAddr, contract.String()) require.NoError(t, err) } // query and check the results are properly sorted q := Querier(keeper) - res, err := q.ContractsByCreator(sdk.WrapSDKContext(ctx), &types.QueryContractsByCreatorRequest{CreatorAddress: creator.String()}) + res, err := q.ContractsByCreator(sdk.WrapSDKContext(ctx), &types.QueryContractsByCreatorRequest{ + CreatorAddress: creator.String(), + Pagination: &query.PageRequest{ + Limit: 50, + }, + }) require.NoError(t, err) - require.Equal(t, 15, len(res.ContractAddress)) + // need sort because `ContractsByCreator` not ordering + sort.Strings(res.ContractAddress) + sort.Strings(expectedContractsAddr) - for _, contractAddr := range res.ContractAddress { - assert.NotEmpty(t, contractAddr) - } + require.Equal(t, res.ContractAddress, expectedContractsAddr) } func fromBase64(s string) []byte { diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 712d828df5..429a98a94e 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -881,8 +881,9 @@ var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo type QueryContractsByCreatorRequest struct { // address is the address of creator - CreatorAddress string `protobuf:"bytes,1,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + CreatorAddress string `protobuf:"bytes,1,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryContractsByCreatorRequest) Reset() { *m = QueryContractsByCreatorRequest{} } @@ -920,6 +921,8 @@ var xxx_messageInfo_QueryContractsByCreatorRequest proto.InternalMessageInfo type QueryContractsByCreatorResponse struct { ContractAddress []string `protobuf:"bytes,1,rep,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryContractsByCreatorResponse) Reset() { *m = QueryContractsByCreatorResponse{} } @@ -984,91 +987,91 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1332 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xa9, 0xe3, 0x1f, 0xd3, 0x94, 0x98, 0x69, 0x49, 0x8c, 0x49, 0x77, 0xa3, 0xa5, - 0xa4, 0x69, 0x1a, 0x76, 0x49, 0x9a, 0x50, 0x40, 0x02, 0x14, 0xa7, 0xd0, 0x24, 0x52, 0xa4, 0x74, - 0x2b, 0x54, 0x89, 0x1e, 0xac, 0xb1, 0x77, 0xe2, 0xac, 0x14, 0xef, 0x3a, 0x3b, 0x93, 0xa4, 0x56, - 0x14, 0x40, 0x95, 0xb8, 0x21, 0x7e, 0x08, 0x71, 0x44, 0x70, 0x40, 0x85, 0x33, 0x5c, 0x10, 0x57, - 0x2e, 0x39, 0x46, 0xe2, 0xc2, 0xc9, 0x02, 0x87, 0x03, 0xca, 0x9f, 0xd0, 0x13, 0xda, 0xd9, 0x59, - 0x7b, 0xd7, 0xf6, 0xc6, 0x4e, 0x65, 0x71, 0xb1, 0xf6, 0xc7, 0x9b, 0x79, 0x9f, 0xf7, 0xdd, 0x37, - 0xef, 0x3d, 0x19, 0x4e, 0x94, 0x6c, 0x5a, 0xd9, 0xc7, 0xb4, 0xa2, 0xf1, 0x9f, 0xbd, 0x39, 0x6d, - 0x67, 0x97, 0x38, 0x35, 0xb5, 0xea, 0xd8, 0xcc, 0x46, 0x19, 0xff, 0xad, 0xca, 0x7f, 0xf6, 0xe6, - 0x72, 0x57, 0xca, 0x76,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8, 0xcc, 0x8d, 0xec, 0x93, 0x91, 0x99, - 0x1b, 0xdd, 0xc6, 0xfa, 0x39, 0x74, 0x54, 0x13, 0x5d, 0x56, 0x3b, 0x68, 0xeb, 0xc2, 0x87, 0xf9, - 0x95, 0xa3, 0xbf, 0xa5, 0xd8, 0x4f, 0x0d, 0x29, 0x76, 0xd4, 0x90, 0xc0, 0x71, 0x43, 0x02, 0x7f, - 0x35, 0x24, 0xf0, 0xe5, 0x89, 0x14, 0x3b, 0x3e, 0x91, 0x62, 0x7f, 0x9e, 0x48, 0xb1, 0x0f, 0xa7, - 0x02, 0x23, 0xf7, 0xb2, 0x4d, 0x2b, 0x0f, 0x7c, 0x17, 0x86, 0xf6, 0xc8, 0x73, 0xc5, 0xff, 0x03, - 0x2a, 0x26, 0xf8, 0x5f, 0x37, 0xb7, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x28, 0x92, 0x6c, 0x5d, - 0x6a, 0x12, 0x00, 0x00, + // 1339 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcd, 0x6f, 0x1b, 0xc5, + 0x1b, 0xc7, 0x3d, 0xa9, 0xe3, 0x97, 0x69, 0xfa, 0x8b, 0x7f, 0xd3, 0x92, 0x18, 0x93, 0xee, 0x46, + 0x4b, 0x49, 0xd3, 0x34, 0xec, 0x92, 0x34, 0xa1, 0x80, 0x04, 0x28, 0x4e, 0xa1, 0x49, 0xa4, 0x48, + 0xe9, 0x56, 0xa8, 0x12, 0x3d, 0x58, 0x63, 0xef, 0xc4, 0x59, 0x29, 0xde, 0x75, 0x76, 0x26, 0x49, + 0xad, 0x28, 0x80, 0x2a, 0x71, 0x43, 0xbc, 0x08, 0x71, 0x44, 0x70, 0x40, 0x05, 0x71, 0x84, 0x0b, + 0xe2, 0xca, 0x25, 0xc7, 0x48, 0x5c, 0x38, 0x59, 0xe0, 0x70, 0x40, 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 0x3d, 0x01, 0x70, 0xb4, 0xad, 0x85, 0x44, 0x2f, 0xf7, 0x70, + 0x17, 0x6e, 0x76, 0x73, 0x6a, 0xbf, 0xe6, 0x02, 0x70, 0x81, 0x03, 0xaa, 0x68, 0xb6, 0x1f, 0x40, + 0x6d, 0x4b, 0x40, 0x7d, 0x17, 0x00, 0x15, 0x5d, 0x5b, 0x4f, 0xd0, 0x70, 0x7b, 0xd9, 0x13, 0xb4, + 0xad, 0x19, 0x54, 0xe6, 0x39, 0xe8, 0x2c, 0x9a, 0xe9, 0x06, 0x6a, 0x10, 0xed, 0x40, 0x1c, 0xfb, + 0x43, 0xad, 0xd5, 0x22, 0x7e, 0x0f, 0x60, 0xa6, 0xbd, 0xa3, 0x42, 0x51, 0x8e, 0x23, 0xba, 0xbf, + 0x9c, 0xd6, 0xb7, 0x7d, 0x3f, 0xa4, 0x1d, 0x92, 0x52, 0x0e, 0xf5, 0x13, 0x80, 0x99, 0xf6, 0x0e, + 0x28, 0x92, 0x34, 0xa2, 0x07, 0x8b, 0x24, 0x8d, 0x6a, 0xad, 0x94, 0x37, 0x39, 0xe9, 0x6d, 0xb4, + 0xd8, 0x17, 0xa9, 0x83, 0xf7, 0xb5, 0x83, 0x56, 0xeb, 0x74, 0x88, 0x7e, 0x05, 0x10, 0x75, 0xb6, + 0x43, 0xe8, 0x95, 0x08, 0x8c, 0xc8, 0x66, 0x2d, 0x37, 0x77, 0x8e, 0x19, 0x02, 0xfd, 0x6d, 0x8e, + 0xfe, 0x3a, 0xba, 0xdd, 0x9f, 0xc8, 0xee, 0x42, 0x61, 0xf8, 0x1a, 0x8c, 0xf3, 0xb4, 0x55, 0x22, + 0xf3, 0xb0, 0x95, 0xab, 0x2f, 0x9e, 0x69, 0x23, 0x88, 0xa6, 0x39, 0x91, 0x82, 0x26, 0x7b, 0x25, + 0x28, 0x72, 0xe0, 0x30, 0x2f, 0x5a, 0xe8, 0xac, 0x75, 0xfd, 0x32, 0x92, 0xbb, 0x76, 0xb6, 0x91, + 0xf0, 0x2e, 0x71, 0xef, 0x59, 0x34, 0xd6, 0xdd, 0x3b, 0xfa, 0x04, 0xc0, 0x8b, 0x81, 0x7a, 0x89, + 0x6e, 0x44, 0xac, 0xda, 0x59, 0xb7, 0x73, 0x33, 0xfd, 0x98, 0x0a, 0x8c, 0x29, 0x8e, 0x31, 0x89, + 0xa4, 0xee, 0x18, 0x54, 0xab, 0xf2, 0x49, 0xe8, 0x10, 0x26, 0xbc, 0x22, 0x87, 0xa2, 0xc2, 0x0b, + 0xd5, 0xd2, 0xdc, 0x4b, 0x3d, 0xac, 0xfa, 0x76, 0xef, 0x39, 0xfd, 0x05, 0x40, 0xd4, 0x59, 0xb2, + 0x22, 0x33, 0x37, 0xb2, 0xe2, 0x46, 0x66, 0x6e, 0x74, 0x3d, 0xec, 0xe7, 0xd0, 0x51, 0x4d, 0xd4, + 0x6b, 0xed, 0xa0, 0xad, 0x9e, 0x1f, 0xe6, 0x57, 0x8e, 0xfe, 0x92, 0x62, 0x3f, 0x34, 0xa4, 0xd8, + 0x51, 0x43, 0x02, 0xc7, 0x0d, 0x09, 0xfc, 0xd9, 0x90, 0xc0, 0xe7, 0x27, 0x52, 0xec, 0xf8, 0x44, + 0x8a, 0xfd, 0x71, 0x22, 0xc5, 0xde, 0x9f, 0x0a, 0x34, 0xef, 0xcb, 0x36, 0xad, 0x3c, 0xf0, 0x5d, + 0x18, 0xda, 0x23, 0xcf, 0x15, 0xff, 0x37, 0xa9, 0x98, 0xe0, 0x7f, 0x02, 0xdd, 0xfa, 0x37, 0x00, + 0x00, 0xff, 0xff, 0x6b, 0x5f, 0x2f, 0xdf, 0xb4, 0x12, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -2503,6 +2506,18 @@ func (m *QueryContractsByCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int _ = i var l int _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if len(m.ContractAddress) > 0 { for iNdEx := len(m.ContractAddress) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.ContractAddress[iNdEx]) @@ -2886,6 +2901,10 @@ func (m *QueryContractsByCreatorResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -5314,6 +5333,42 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { } m.ContractAddress = append(m.ContractAddress, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From b6241b3a79064ac1d8c6f6fe067b4dcb9915c9d3 Mon Sep 17 00:00:00 2001 From: vuong Date: Thu, 29 Sep 2022 23:24:05 +0700 Subject: [PATCH 30/35] ordering query --- x/wasm/keeper/genesis_test.go | 2 +- x/wasm/keeper/keeper.go | 10 ++-- x/wasm/keeper/keeper_test.go | 16 ++++--- x/wasm/keeper/migrations.go | 2 +- x/wasm/keeper/querier.go | 6 ++- x/wasm/keeper/querier_test.go | 86 +++++++++++++++++++++++++---------- x/wasm/types/keys.go | 13 ++++-- x/wasm/types/keys_test.go | 16 +++++-- 8 files changed, 108 insertions(+), 43 deletions(-) diff --git a/x/wasm/keeper/genesis_test.go b/x/wasm/keeper/genesis_test.go index 1cfe9d9a0d..1d8f29a40f 100644 --- a/x/wasm/keeper/genesis_test.go +++ b/x/wasm/keeper/genesis_test.go @@ -123,7 +123,7 @@ func TestGenesisExportImport(t *testing.T) { newHistory := x.ResetFromGenesis(dstCtx) wasmKeeper.storeContractInfo(srcCtx, address, x) wasmKeeper.addToContractCodeSecondaryIndex(srcCtx, address, newHistory) - wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, address) + wasmKeeper.addToContractCreatorSecondaryIndex(srcCtx, creatorAddress, newHistory.Updated, address) wasmKeeper.appendToContractHistory(srcCtx, address, newHistory) iter.Close() return false diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index f4d09dcd45..c02fb09b63 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -378,7 +378,7 @@ func (k Keeper) instantiate( // store contract before dispatch so that contract could be called back historyEntry := contractInfo.InitialHistory(initMsg) k.addToContractCodeSecondaryIndex(ctx, contractAddress, historyEntry) - k.addToContractCreatorSecondaryIndex(ctx, creator, contractAddress) + k.addToContractCreatorSecondaryIndex(ctx, creator, historyEntry.Updated, contractAddress) k.appendToContractHistory(ctx, contractAddress, historyEntry) k.storeContractInfo(ctx, contractAddress, &contractInfo) @@ -597,9 +597,9 @@ func (k Keeper) removeFromContractCodeSecondaryIndex(ctx sdk.Context, contractAd } // addToContractCreatorSecondaryIndex adds element to the index for contracts-by-creator queries -func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddress, contractAddress sdk.AccAddress) { +func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddress sdk.AccAddress, position *types.AbsoluteTxPosition, contractAddress sdk.AccAddress) { store := ctx.KVStore(k.storeKey) - store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, contractAddress), []byte{}) + store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, position.Bytes(), contractAddress), []byte{}) } // IterateContractsByCreator iterates over all contracts with given creator address. @@ -607,7 +607,7 @@ func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddres prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { key := iter.Key() - if cb(key) { + if cb(key[types.AbsoluteTxPositionLen:]) { return } } @@ -1076,7 +1076,7 @@ func (k Keeper) importContract(ctx sdk.Context, contractAddr sdk.AccAddress, c * k.appendToContractHistory(ctx, contractAddr, historyEntry) k.storeContractInfo(ctx, contractAddr, c) k.addToContractCodeSecondaryIndex(ctx, contractAddr, historyEntry) - k.addToContractCreatorSecondaryIndex(ctx, creatorAddress, contractAddr) + k.addToContractCreatorSecondaryIndex(ctx, creatorAddress, historyEntry.Updated, contractAddr) return k.importContractState(ctx, contractAddr, state) } diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 78aba05d6f..1344e80881 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -400,7 +400,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x1a5db), gasAfter-gasBefore) + require.Equal(t, uint64(0x1a7bb), gasAfter-gasBefore) } // ensure it is stored properly @@ -2233,10 +2233,14 @@ func TestIteratorContractByCreator(t *testing.T) { depositContract := sdk.NewCoins(sdk.NewCoin("denom", sdk.NewInt(1_000))) gotAddr1, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, mockAddress1, nil, initMsgBz, "label", depositContract) - gotAddr2, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, mockAddress2, nil, initMsgBz, "label", depositContract) - gotAddr3, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract1ID, gotAddr1, nil, initMsgBz, "label", depositContract) - gotAddr4, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract2ID, mockAddress2, nil, initMsgBz, "label", depositContract) - gotAddr5, _, _ := keepers.ContractKeeper.Instantiate(parentCtx, contract2ID, mockAddress2, nil, initMsgBz, "label", depositContract) + ctx := parentCtx.WithBlockHeight(parentCtx.BlockHeight() + 1) + gotAddr2, _, _ := keepers.ContractKeeper.Instantiate(ctx, contract1ID, mockAddress2, nil, initMsgBz, "label", depositContract) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + gotAddr3, _, _ := keepers.ContractKeeper.Instantiate(ctx, contract1ID, gotAddr1, nil, initMsgBz, "label", depositContract) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + gotAddr4, _, _ := keepers.ContractKeeper.Instantiate(ctx, contract2ID, mockAddress2, nil, initMsgBz, "label", depositContract) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + gotAddr5, _, _ := keepers.ContractKeeper.Instantiate(ctx, contract2ID, mockAddress2, nil, initMsgBz, "label", depositContract) specs := map[string]struct { creatorAddr sdk.AccAddress @@ -2248,7 +2252,7 @@ func TestIteratorContractByCreator(t *testing.T) { }, "muliple contracts": { creatorAddr: mockAddress2, - contractsAddr: []string{gotAddr2.String(), gotAddr5.String(), gotAddr4.String()}, + contractsAddr: []string{gotAddr2.String(), gotAddr4.String(), gotAddr5.String()}, }, "contractAdress": { creatorAddr: gotAddr1, diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go index 71783d0118..a669815e16 100644 --- a/x/wasm/keeper/migrations.go +++ b/x/wasm/keeper/migrations.go @@ -19,7 +19,7 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate2to3(ctx sdk.Context) error { m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool { creator := sdk.MustAccAddressFromBech32(contractInfo.Creator) - m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractAddr) + m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractInfo.Created, contractAddr) return false }) return nil diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index f3a4e171d7..8460b854d0 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -333,12 +333,16 @@ func (q grpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContr prefixStore := prefix.NewStore(ctx.KVStore(q.storeKey), types.GetContractsByCreatorPrefix(creatorAddress)) pageRes, err := query.FilteredPaginate(prefixStore, req.Pagination, func(key []byte, _ []byte, accumulate bool) (bool, error) { if accumulate { - accAddres := sdk.AccAddress(key) + accAddres := sdk.AccAddress(key[types.AbsoluteTxPositionLen:]) contracts = append(contracts, accAddres.String()) } return true, nil }) + if err != nil { + return nil, err + } + return &types.QueryContractsByCreatorResponse{ ContractAddress: contracts, Pagination: pageRes, diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 98c554be38..1665335a3b 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "os" - "sort" "testing" "time" @@ -805,7 +804,6 @@ func TestQueryCodeInfoList(t *testing.T) { func TestQueryContractsByCreatorList(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) - keeper := keepers.WasmKeeper deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 1000000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 500)) @@ -836,34 +834,76 @@ func TestQueryContractsByCreatorList(t *testing.T) { return ctx } - var expectedContractsAddr []string - // create 50 contracts with real block/gas setup - for i := 0; i < 50; i++ { - // 3 tx per block, so we ensure both comparisons work - if i%3 == 0 { - ctx = setBlock(ctx, h) - h++ - } + var allExpecedContracts []string + // create 10 contracts with real block/gas setup + for i := 0; i < 10; i++ { + ctx = setBlock(ctx, h) + h++ contract, _, err := keepers.ContractKeeper.Instantiate(ctx, codeID, creator, nil, initMsgBz, fmt.Sprintf("contract %d", i), topUp) - expectedContractsAddr = append(expectedContractsAddr, contract.String()) + allExpecedContracts = append(allExpecedContracts, contract.String()) require.NoError(t, err) } - // query and check the results are properly sorted - q := Querier(keeper) - res, err := q.ContractsByCreator(sdk.WrapSDKContext(ctx), &types.QueryContractsByCreatorRequest{ - CreatorAddress: creator.String(), - Pagination: &query.PageRequest{ - Limit: 50, + specs := map[string]struct { + srcQuery *types.QueryContractsByCreatorRequest + expContractAddr []string + expErr error + }{ + "query all": { + srcQuery: &types.QueryContractsByCreatorRequest{ + CreatorAddress: creator.String(), + }, + expContractAddr: allExpecedContracts, + expErr: nil, }, - }) - require.NoError(t, err) + "with pagination offset": { + srcQuery: &types.QueryContractsByCreatorRequest{ + CreatorAddress: creator.String(), + Pagination: &query.PageRequest{ + Offset: 1, + }, + }, + expContractAddr: allExpecedContracts[1:], + expErr: nil, + }, + "with pagination limit": { + srcQuery: &types.QueryContractsByCreatorRequest{ + CreatorAddress: creator.String(), + Pagination: &query.PageRequest{ + Limit: 1, + }, + }, + expContractAddr: allExpecedContracts[0:1], + expErr: nil, + }, + "nil cretor": { + srcQuery: &types.QueryContractsByCreatorRequest{ + Pagination: &query.PageRequest{}, + }, + expContractAddr: allExpecedContracts, + expErr: errors.New("empty address string is not allowed"), + }, + "nil req": { + srcQuery: nil, + expContractAddr: allExpecedContracts, + expErr: status.Error(codes.InvalidArgument, "empty request"), + }, + } - // need sort because `ContractsByCreator` not ordering - sort.Strings(res.ContractAddress) - sort.Strings(expectedContractsAddr) + q := Querier(keepers.WasmKeeper) + for msg, spec := range specs { + t.Run(msg, func(t *testing.T) { + got, err := q.ContractsByCreator(sdk.WrapSDKContext(ctx), spec.srcQuery) + + if spec.expErr != nil { + require.Equal(t, spec.expErr, err) + return + } - require.Equal(t, res.ContractAddress, expectedContractsAddr) + require.NotNil(t, got) + assert.Equal(t, spec.expContractAddr, got.ContractAddress) + }) + } } func fromBase64(s string) []byte { diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index b7e0b9ff37..95078e1445 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -83,10 +83,17 @@ func GetContractByCodeIDSecondaryIndexPrefix(codeID uint64) []byte { return r } -// GetContractByCreatorSecondaryIndexKey returns the key for the second index: `` -func GetContractByCreatorSecondaryIndexKey(bz []byte, contractAddr sdk.AccAddress) []byte { +// GetContractByCreatorSecondaryIndexKey returns the key for the second index: `` +func GetContractByCreatorSecondaryIndexKey(bz []byte, position []byte, contractAddr sdk.AccAddress) []byte { prefixBytes := GetContractsByCreatorPrefix(bz) - return append(prefixBytes, contractAddr...) + lenPrefixBytes := len(prefixBytes) + r := make([]byte, lenPrefixBytes+AbsoluteTxPositionLen+len(contractAddr)) + + copy(r[:lenPrefixBytes], prefixBytes) + copy(r[lenPrefixBytes:lenPrefixBytes+AbsoluteTxPositionLen], position) + copy(r[lenPrefixBytes+AbsoluteTxPositionLen:], contractAddr) + + return r } // GetContractCodeHistoryElementKey returns the key a contract code history entry: `` diff --git a/x/wasm/types/keys_test.go b/x/wasm/types/keys_test.go index dcc08dba70..3db6bbadfe 100644 --- a/x/wasm/types/keys_test.go +++ b/x/wasm/types/keys_test.go @@ -88,15 +88,21 @@ func TestGetContractByCreatedSecondaryIndexKey(t *testing.T) { func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { creatorAddr := bytes.Repeat([]byte{4}, 20) + e := ContractCodeHistoryEntry{ + CodeID: 1, + Updated: &AbsoluteTxPosition{2 + 1<<(8*7), 3 + 1<<(8*7)}, + } // test that contract addresses of 20 length are still supported contractAddr := bytes.Repeat([]byte{4}, 20) - got := GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) + got := GetContractByCreatorSecondaryIndexKey(creatorAddr, e.Updated.Bytes(), contractAddr) exp := []byte{ 9, // prefix 20, // creator address length 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address with fixed length prefix 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 0, 0, 0, 0, 0, 0, 2, // height + 1, 0, 0, 0, 0, 0, 0, 3, // index 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 20 bytes 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, } @@ -104,12 +110,14 @@ func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { // test that contract addresses of 32 length are still supported contractAddr = bytes.Repeat([]byte{4}, 32) - got = GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) + got = GetContractByCreatorSecondaryIndexKey(creatorAddr, e.Updated.Bytes(), contractAddr) exp = []byte{ 9, // prefix 20, // creator address length 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // creator address with fixed length prefix 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 0, 0, 0, 0, 0, 0, 2, // height + 1, 0, 0, 0, 0, 0, 0, 3, // index 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 32 bytes 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -119,7 +127,7 @@ func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { // test that creator is contract addresses of 32 length contractAddr = bytes.Repeat([]byte{4}, 32) creatorAddr = bytes.Repeat([]byte{8}, 32) - got = GetContractByCreatorSecondaryIndexKey(creatorAddr, contractAddr) + got = GetContractByCreatorSecondaryIndexKey(creatorAddr, e.Updated.Bytes(), contractAddr) exp = []byte{ 9, // prefix 32, // creator address length @@ -127,6 +135,8 @@ func TestGetContractByCreatorSecondaryIndexKey(t *testing.T) { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 1, 0, 0, 0, 0, 0, 0, 2, // height + 1, 0, 0, 0, 0, 0, 0, 3, // index 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, // address 32 bytes 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, From c06004554db0b99eaf1f54cb0344aa93c5ff9476 Mon Sep 17 00:00:00 2001 From: vuong Date: Fri, 30 Sep 2022 17:26:29 +0700 Subject: [PATCH 31/35] add migrate test --- x/wasm/keeper/migrate_test.go | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 x/wasm/keeper/migrate_test.go diff --git a/x/wasm/keeper/migrate_test.go b/x/wasm/keeper/migrate_test.go new file mode 100644 index 0000000000..fd0b2a80c1 --- /dev/null +++ b/x/wasm/keeper/migrate_test.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "bytes" + "encoding/json" + "testing" + + "github.com/CosmWasm/wasmd/x/wasm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/stretchr/testify/require" +) + +func TestMigrate2To3(t *testing.T) { + ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) + wasmKeeper := keepers.WasmKeeper + + deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) + creator := sdk.AccAddress(bytes.Repeat([]byte{1}, address.Len)) + keepers.Faucet.Fund(ctx, creator, deposit...) + example := StoreHackatomExampleContract(t, ctx, keepers) + + initMsg := HackatomExampleInitMsg{ + Verifier: RandomAccountAddress(t), + Beneficiary: RandomAccountAddress(t), + } + initMsgBz, err := json.Marshal(initMsg) + require.NoError(t, err) + + em := sdk.NewEventManager() + + // create with no balance is also legal + gotContractAddr1, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + gotContractAddr2, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil) + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + gotContractAddr3, _, err := keepers.ContractKeeper.Instantiate(ctx.WithEventManager(em), example.CodeID, creator, nil, initMsgBz, "demo contract 1", nil) + + info1 := wasmKeeper.GetContractInfo(ctx, gotContractAddr1) + info2 := wasmKeeper.GetContractInfo(ctx, gotContractAddr2) + info3 := wasmKeeper.GetContractInfo(ctx, gotContractAddr3) + + // remove key + ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info1.Created.Bytes(), gotContractAddr1)) + ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info2.Created.Bytes(), gotContractAddr2)) + ctx.KVStore(wasmKeeper.storeKey).Delete(types.GetContractByCreatorSecondaryIndexKey(creator, info3.Created.Bytes(), gotContractAddr3)) + + // migrator + migrator := NewMigrator(*wasmKeeper) + migrator.Migrate2to3(ctx) + + // check new store + var allContract []string + wasmKeeper.IterateContractsByCreator(ctx, creator, func(addr sdk.AccAddress) bool { + allContract = append(allContract, addr.String()) + return false + }) + + require.Equal(t, []string{gotContractAddr1.String(), gotContractAddr2.String(), gotContractAddr3.String()}, allContract) +} From dfbdfc20cf72b618b0bf414addc34a9763897f6b Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Thu, 6 Oct 2022 12:55:45 +0200 Subject: [PATCH 32/35] Make ContractsByCreator plural; formatting and minor updates --- docs/proto/proto-docs.md | 37 +++ proto/cosmwasm/wasm/v1/query.proto | 21 +- x/wasm/keeper/keeper_test.go | 2 +- x/wasm/keeper/migrate_test.go | 3 +- x/wasm/keeper/migrations.go | 3 +- x/wasm/keeper/querier.go | 5 +- x/wasm/keeper/querier_test.go | 6 +- x/wasm/types/query.pb.go | 372 +++++++++++++++++++++-------- x/wasm/types/query.pb.gw.go | 120 ++-------- 9 files changed, 341 insertions(+), 228 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index add638f07f..d6e5aee1d6 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -73,6 +73,8 @@ - [QueryContractInfoResponse](#cosmwasm.wasm.v1.QueryContractInfoResponse) - [QueryContractsByCodeRequest](#cosmwasm.wasm.v1.QueryContractsByCodeRequest) - [QueryContractsByCodeResponse](#cosmwasm.wasm.v1.QueryContractsByCodeResponse) + - [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) + - [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) - [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) - [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) - [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) @@ -1131,6 +1133,40 @@ Query/ContractsByCode RPC method + + +### QueryContractsByCreatorRequest +QueryContractsByCreatorRequest is the request type for the +Query/ContractsByCreator RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `creator_address` | [string](#string) | | CreatorAddress is the address of contract creator | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | Pagination defines an optional pagination for the request. | + + + + + + + + +### QueryContractsByCreatorResponse +QueryContractsByCreatorResponse is the response type for the +Query/ContractsByCreator RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `contract_addresses` | [string](#string) | repeated | ContractAddresses result set | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | Pagination defines the pagination in the response. | + + + + + + ### QueryParamsRequest @@ -1278,6 +1314,7 @@ Query provides defines the gRPC querier service | `Codes` | [QueryCodesRequest](#cosmwasm.wasm.v1.QueryCodesRequest) | [QueryCodesResponse](#cosmwasm.wasm.v1.QueryCodesResponse) | Codes gets the metadata for all stored wasm codes | GET|/cosmwasm/wasm/v1/code| | `PinnedCodes` | [QueryPinnedCodesRequest](#cosmwasm.wasm.v1.QueryPinnedCodesRequest) | [QueryPinnedCodesResponse](#cosmwasm.wasm.v1.QueryPinnedCodesResponse) | PinnedCodes gets the pinned code ids | GET|/cosmwasm/wasm/v1/codes/pinned| | `Params` | [QueryParamsRequest](#cosmwasm.wasm.v1.QueryParamsRequest) | [QueryParamsResponse](#cosmwasm.wasm.v1.QueryParamsResponse) | Params gets the module params | GET|/cosmwasm/wasm/v1/codes/params| +| `ContractsByCreator` | [QueryContractsByCreatorRequest](#cosmwasm.wasm.v1.QueryContractsByCreatorRequest) | [QueryContractsByCreatorResponse](#cosmwasm.wasm.v1.QueryContractsByCreatorResponse) | ContractsByCreator gets the contracts by creator | GET|/cosmwasm/wasm/v1/contracts/creator/{creator_address}| diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index 354165c738..ffe48d2429 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -65,8 +65,10 @@ service Query { } // ContractsByCreator gets the contracts by creator - rpc ContractsByCreator(QueryContractsByCreatorRequest) returns (QueryContractsByCreatorResponse){ - option (google.api.http).get = "/cosmwasm/wasm/v1/contracts/creator/{creator_address}"; + rpc ContractsByCreator(QueryContractsByCreatorRequest) + returns (QueryContractsByCreatorResponse) { + option (google.api.http).get = + "/cosmwasm/wasm/v1/contracts/creator/{creator_address}"; } } @@ -242,17 +244,20 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } +// QueryContractsByCreatorRequest is the request type for the +// Query/ContractsByCreator RPC method. message QueryContractsByCreatorRequest { - // address is the address of creator + // CreatorAddress is the address of contract creator string creator_address = 1; - // pagination defines an optional pagination for the request. + // Pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; } +// QueryContractsByCreatorResponse is the response type for the +// Query/ContractsByCreator RPC method. message QueryContractsByCreatorResponse { - repeated string contract_address = 1 - [ (gogoproto.customname) = "ContractAddress" ]; - // pagination defines the pagination in the response. + // ContractAddresses result set + repeated string contract_addresses = 1; + // Pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; - } \ No newline at end of file diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index 1344e80881..e385c8268f 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -2250,7 +2250,7 @@ func TestIteratorContractByCreator(t *testing.T) { creatorAddr: mockAddress1, contractsAddr: []string{gotAddr1.String()}, }, - "muliple contracts": { + "multiple contracts": { creatorAddr: mockAddress2, contractsAddr: []string{gotAddr2.String(), gotAddr4.String(), gotAddr5.String()}, }, diff --git a/x/wasm/keeper/migrate_test.go b/x/wasm/keeper/migrate_test.go index fd0b2a80c1..a6c5b8ddeb 100644 --- a/x/wasm/keeper/migrate_test.go +++ b/x/wasm/keeper/migrate_test.go @@ -5,10 +5,11 @@ import ( "encoding/json" "testing" - "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" "github.com/stretchr/testify/require" + + "github.com/CosmWasm/wasmd/x/wasm/types" ) func TestMigrate2To3(t *testing.T) { diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go index a669815e16..9948a22633 100644 --- a/x/wasm/keeper/migrations.go +++ b/x/wasm/keeper/migrations.go @@ -1,8 +1,9 @@ package keeper import ( - "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/CosmWasm/wasmd/x/wasm/types" ) // Migrator is a struct for handling in-place store migrations. diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index 8460b854d0..9b23c68d96 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -338,13 +338,12 @@ func (q grpcQuerier) ContractsByCreator(c context.Context, req *types.QueryContr } return true, nil }) - if err != nil { return nil, err } return &types.QueryContractsByCreatorResponse{ - ContractAddress: contracts, - Pagination: pageRes, + ContractAddresses: contracts, + Pagination: pageRes, }, nil } diff --git a/x/wasm/keeper/querier_test.go b/x/wasm/keeper/querier_test.go index 1665335a3b..52a17d0e11 100644 --- a/x/wasm/keeper/querier_test.go +++ b/x/wasm/keeper/querier_test.go @@ -876,7 +876,7 @@ func TestQueryContractsByCreatorList(t *testing.T) { expContractAddr: allExpecedContracts[0:1], expErr: nil, }, - "nil cretor": { + "nil creator": { srcQuery: &types.QueryContractsByCreatorRequest{ Pagination: &query.PageRequest{}, }, @@ -899,9 +899,9 @@ func TestQueryContractsByCreatorList(t *testing.T) { require.Equal(t, spec.expErr, err) return } - + require.NoError(t, err) require.NotNil(t, got) - assert.Equal(t, spec.expContractAddr, got.ContractAddress) + assert.Equal(t, spec.expContractAddr, got.ContractAddresses) }) } } diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 429a98a94e..31acbb09ba 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -7,6 +7,10 @@ import ( bytes "bytes" context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -16,15 +20,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf + +var ( + _ = fmt.Errorf + _ = math.Inf +) // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,9 +49,11 @@ func (*QueryContractInfoRequest) ProtoMessage() {} func (*QueryContractInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{0} } + func (m *QueryContractInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoRequest.Marshal(b, m, deterministic) @@ -60,12 +66,15 @@ func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *QueryContractInfoRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoRequest.Merge(m, src) } + func (m *QueryContractInfoRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractInfoRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoRequest.DiscardUnknown(m) } @@ -86,9 +95,11 @@ func (*QueryContractInfoResponse) ProtoMessage() {} func (*QueryContractInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{1} } + func (m *QueryContractInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoResponse.Marshal(b, m, deterministic) @@ -101,12 +112,15 @@ func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } + func (m *QueryContractInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoResponse.Merge(m, src) } + func (m *QueryContractInfoResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoResponse.DiscardUnknown(m) } @@ -128,9 +142,11 @@ func (*QueryContractHistoryRequest) ProtoMessage() {} func (*QueryContractHistoryRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{2} } + func (m *QueryContractHistoryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryRequest.Marshal(b, m, deterministic) @@ -143,12 +159,15 @@ func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractHistoryRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryRequest.Merge(m, src) } + func (m *QueryContractHistoryRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractHistoryRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryRequest.DiscardUnknown(m) } @@ -169,9 +188,11 @@ func (*QueryContractHistoryResponse) ProtoMessage() {} func (*QueryContractHistoryResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{3} } + func (m *QueryContractHistoryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryResponse.Marshal(b, m, deterministic) @@ -184,12 +205,15 @@ func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractHistoryResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryResponse.Merge(m, src) } + func (m *QueryContractHistoryResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractHistoryResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryResponse.DiscardUnknown(m) } @@ -210,9 +234,11 @@ func (*QueryContractsByCodeRequest) ProtoMessage() {} func (*QueryContractsByCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{4} } + func (m *QueryContractsByCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeRequest.Marshal(b, m, deterministic) @@ -225,12 +251,15 @@ func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractsByCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeRequest.Merge(m, src) } + func (m *QueryContractsByCodeRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeRequest.DiscardUnknown(m) } @@ -252,9 +281,11 @@ func (*QueryContractsByCodeResponse) ProtoMessage() {} func (*QueryContractsByCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{5} } + func (m *QueryContractsByCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeResponse.Marshal(b, m, deterministic) @@ -267,12 +298,15 @@ func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryContractsByCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeResponse.Merge(m, src) } + func (m *QueryContractsByCodeResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeResponse.DiscardUnknown(m) } @@ -294,9 +328,11 @@ func (*QueryAllContractStateRequest) ProtoMessage() {} func (*QueryAllContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{6} } + func (m *QueryAllContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateRequest.Marshal(b, m, deterministic) @@ -309,12 +345,15 @@ func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryAllContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateRequest.Merge(m, src) } + func (m *QueryAllContractStateRequest) XXX_Size() int { return m.Size() } + func (m *QueryAllContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateRequest.DiscardUnknown(m) } @@ -335,9 +374,11 @@ func (*QueryAllContractStateResponse) ProtoMessage() {} func (*QueryAllContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{7} } + func (m *QueryAllContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateResponse.Marshal(b, m, deterministic) @@ -350,12 +391,15 @@ func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryAllContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateResponse.Merge(m, src) } + func (m *QueryAllContractStateResponse) XXX_Size() int { return m.Size() } + func (m *QueryAllContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateResponse.DiscardUnknown(m) } @@ -376,9 +420,11 @@ func (*QueryRawContractStateRequest) ProtoMessage() {} func (*QueryRawContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{8} } + func (m *QueryRawContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateRequest.Marshal(b, m, deterministic) @@ -391,12 +437,15 @@ func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } + func (m *QueryRawContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateRequest.Merge(m, src) } + func (m *QueryRawContractStateRequest) XXX_Size() int { return m.Size() } + func (m *QueryRawContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateRequest.DiscardUnknown(m) } @@ -416,9 +465,11 @@ func (*QueryRawContractStateResponse) ProtoMessage() {} func (*QueryRawContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{9} } + func (m *QueryRawContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateResponse.Marshal(b, m, deterministic) @@ -431,12 +482,15 @@ func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } + func (m *QueryRawContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateResponse.Merge(m, src) } + func (m *QueryRawContractStateResponse) XXX_Size() int { return m.Size() } + func (m *QueryRawContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateResponse.DiscardUnknown(m) } @@ -458,9 +512,11 @@ func (*QuerySmartContractStateRequest) ProtoMessage() {} func (*QuerySmartContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{10} } + func (m *QuerySmartContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateRequest.Marshal(b, m, deterministic) @@ -473,12 +529,15 @@ func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QuerySmartContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateRequest.Merge(m, src) } + func (m *QuerySmartContractStateRequest) XXX_Size() int { return m.Size() } + func (m *QuerySmartContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateRequest.DiscardUnknown(m) } @@ -498,9 +557,11 @@ func (*QuerySmartContractStateResponse) ProtoMessage() {} func (*QuerySmartContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{11} } + func (m *QuerySmartContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateResponse.Marshal(b, m, deterministic) @@ -513,12 +574,15 @@ func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *QuerySmartContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateResponse.Merge(m, src) } + func (m *QuerySmartContractStateResponse) XXX_Size() int { return m.Size() } + func (m *QuerySmartContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateResponse.DiscardUnknown(m) } @@ -536,9 +600,11 @@ func (*QueryCodeRequest) ProtoMessage() {} func (*QueryCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{12} } + func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeRequest.Marshal(b, m, deterministic) @@ -551,12 +617,15 @@ func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *QueryCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeRequest.Merge(m, src) } + func (m *QueryCodeRequest) XXX_Size() int { return m.Size() } + func (m *QueryCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeRequest.DiscardUnknown(m) } @@ -577,9 +646,11 @@ func (*CodeInfoResponse) ProtoMessage() {} func (*CodeInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{13} } + func (m *CodeInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeInfoResponse.Marshal(b, m, deterministic) @@ -592,12 +663,15 @@ func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } + func (m *CodeInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeInfoResponse.Merge(m, src) } + func (m *CodeInfoResponse) XXX_Size() int { return m.Size() } + func (m *CodeInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_CodeInfoResponse.DiscardUnknown(m) } @@ -616,9 +690,11 @@ func (*QueryCodeResponse) ProtoMessage() {} func (*QueryCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{14} } + func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeResponse.Marshal(b, m, deterministic) @@ -631,12 +707,15 @@ func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } + func (m *QueryCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeResponse.Merge(m, src) } + func (m *QueryCodeResponse) XXX_Size() int { return m.Size() } + func (m *QueryCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeResponse.DiscardUnknown(m) } @@ -655,9 +734,11 @@ func (*QueryCodesRequest) ProtoMessage() {} func (*QueryCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{15} } + func (m *QueryCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesRequest.Marshal(b, m, deterministic) @@ -670,12 +751,15 @@ func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } + func (m *QueryCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesRequest.Merge(m, src) } + func (m *QueryCodesRequest) XXX_Size() int { return m.Size() } + func (m *QueryCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesRequest.DiscardUnknown(m) } @@ -695,9 +779,11 @@ func (*QueryCodesResponse) ProtoMessage() {} func (*QueryCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{16} } + func (m *QueryCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesResponse.Marshal(b, m, deterministic) @@ -710,12 +796,15 @@ func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesResponse.Merge(m, src) } + func (m *QueryCodesResponse) XXX_Size() int { return m.Size() } + func (m *QueryCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesResponse.DiscardUnknown(m) } @@ -735,9 +824,11 @@ func (*QueryPinnedCodesRequest) ProtoMessage() {} func (*QueryPinnedCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{17} } + func (m *QueryPinnedCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesRequest.Marshal(b, m, deterministic) @@ -750,12 +841,15 @@ func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } + func (m *QueryPinnedCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesRequest.Merge(m, src) } + func (m *QueryPinnedCodesRequest) XXX_Size() int { return m.Size() } + func (m *QueryPinnedCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesRequest.DiscardUnknown(m) } @@ -776,9 +870,11 @@ func (*QueryPinnedCodesResponse) ProtoMessage() {} func (*QueryPinnedCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{18} } + func (m *QueryPinnedCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesResponse.Marshal(b, m, deterministic) @@ -791,12 +887,15 @@ func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } + func (m *QueryPinnedCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesResponse.Merge(m, src) } + func (m *QueryPinnedCodesResponse) XXX_Size() int { return m.Size() } + func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesResponse.DiscardUnknown(m) } @@ -804,8 +903,7 @@ func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryPinnedCodesResponse proto.InternalMessageInfo // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} +type QueryParamsRequest struct{} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -813,9 +911,11 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{19} } + func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -828,12 +928,15 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } + func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } + func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -852,9 +955,11 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{20} } + func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -867,22 +972,27 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } + func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } + func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } + func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo +// QueryContractsByCreatorRequest is the request type for the +// Query/ContractsByCreator RPC method. type QueryContractsByCreatorRequest struct { - // address is the address of creator + // CreatorAddress is the address of contract creator CreatorAddress string `protobuf:"bytes,1,opt,name=creator_address,json=creatorAddress,proto3" json:"creator_address,omitempty"` - // pagination defines an optional pagination for the request. + // Pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -892,9 +1002,11 @@ func (*QueryContractsByCreatorRequest) ProtoMessage() {} func (*QueryContractsByCreatorRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{21} } + func (m *QueryContractsByCreatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCreatorRequest.Marshal(b, m, deterministic) @@ -907,21 +1019,27 @@ func (m *QueryContractsByCreatorRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } + func (m *QueryContractsByCreatorRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCreatorRequest.Merge(m, src) } + func (m *QueryContractsByCreatorRequest) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCreatorRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCreatorRequest.DiscardUnknown(m) } var xxx_messageInfo_QueryContractsByCreatorRequest proto.InternalMessageInfo +// QueryContractsByCreatorResponse is the response type for the +// Query/ContractsByCreator RPC method. type QueryContractsByCreatorResponse struct { - ContractAddress []string `protobuf:"bytes,1,rep,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - // pagination defines the pagination in the response. + // ContractAddresses result set + ContractAddresses []string `protobuf:"bytes,1,rep,name=contract_addresses,json=contractAddresses,proto3" json:"contract_addresses,omitempty"` + // Pagination defines the pagination in the response. Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -931,9 +1049,11 @@ func (*QueryContractsByCreatorResponse) ProtoMessage() {} func (*QueryContractsByCreatorResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{22} } + func (m *QueryContractsByCreatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } + func (m *QueryContractsByCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCreatorResponse.Marshal(b, m, deterministic) @@ -946,12 +1066,15 @@ func (m *QueryContractsByCreatorResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } + func (m *QueryContractsByCreatorResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCreatorResponse.Merge(m, src) } + func (m *QueryContractsByCreatorResponse) XXX_Size() int { return m.Size() } + func (m *QueryContractsByCreatorResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCreatorResponse.DiscardUnknown(m) } @@ -987,91 +1110,91 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1339 bytes of a gzipped FileDescriptorProto + // 1331 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0xcd, 0x6f, 0x1b, 0xc5, - 0x1b, 0xc7, 0x3d, 0xa9, 0xe3, 0x97, 0x69, 0xfa, 0x8b, 0x7f, 0xd3, 0x92, 0x18, 0x93, 0xee, 0x46, - 0x4b, 0x49, 0xd3, 0x34, 0xec, 0x92, 0x34, 0xa1, 0x80, 0x04, 0x28, 0x4e, 0xa1, 0x49, 0xa4, 0x48, - 0xe9, 0x56, 0xa8, 0x12, 0x3d, 0x58, 0x63, 0xef, 0xc4, 0x59, 0x29, 0xde, 0x75, 0x76, 0x26, 0x49, - 0xad, 0x28, 0x80, 0x2a, 0x71, 0x43, 0xbc, 0x08, 0x71, 0x44, 0x70, 0x40, 0x05, 0x71, 0x84, 0x0b, - 0xe2, 0xca, 0x25, 0xc7, 0x48, 0x5c, 0x38, 0x59, 0xe0, 0x70, 0x40, 0xf9, 0x13, 0x7a, 0x42, 0x3b, - 0x3b, 0x6b, 0xef, 0xda, 0xde, 0xd8, 0xa9, 0x2c, 0x2e, 0xd6, 0xee, 0xce, 0x33, 0xf3, 0x7c, 0x9e, - 0xef, 0x3c, 0x33, 0xcf, 0x23, 0xc3, 0x89, 0x92, 0x4d, 0x2b, 0xfb, 0x98, 0x56, 0x34, 0xfe, 0xb3, - 0x37, 0xa7, 0xed, 0xec, 0x12, 0xa7, 0xa6, 0x56, 0x1d, 0x9b, 0xd9, 0x28, 0xe3, 0x8f, 0xaa, 0xfc, - 0x67, 0x6f, 0x2e, 0x77, 0xa5, 0x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xad, 0xd5, 0x22, 0x7e, 0x0f, 0x60, 0xa6, 0xbd, 0xa3, 0x42, 0x51, 0x8e, 0x23, 0xba, 0xbf, - 0x9c, 0xd6, 0xb7, 0x7d, 0x3f, 0xa4, 0x1d, 0x92, 0x52, 0x0e, 0xf5, 0x13, 0x80, 0x99, 0xf6, 0x0e, - 0x28, 0x92, 0x34, 0xa2, 0x07, 0x8b, 0x24, 0x8d, 0x6a, 0xad, 0x94, 0x37, 0x39, 0xe9, 0x6d, 0xb4, - 0xd8, 0x17, 0xa9, 0x83, 0xf7, 0xb5, 0x83, 0x56, 0xeb, 0x74, 0x88, 0x7e, 0x05, 0x10, 0x75, 0xb6, - 0x43, 0xe8, 0x95, 0x08, 0x8c, 0xc8, 0x66, 0x2d, 0x37, 0x77, 0x8e, 0x19, 0x02, 0xfd, 0x6d, 0x8e, - 0xfe, 0x3a, 0xba, 0xdd, 0x9f, 0xc8, 0xee, 0x42, 0x61, 0xf8, 0x1a, 0x8c, 0xf3, 0xb4, 0x55, 0x22, - 0xf3, 0xb0, 0x95, 0xab, 0x2f, 0x9e, 0x69, 0x23, 0x88, 0xa6, 0x39, 0x91, 0x82, 0x26, 0x7b, 0x25, - 0x28, 0x72, 0xe0, 0x30, 0x2f, 0x5a, 0xe8, 0xac, 0x75, 0xfd, 0x32, 0x92, 0xbb, 0x76, 0xb6, 0x91, - 0xf0, 0x2e, 0x71, 0xef, 0x59, 0x34, 0xd6, 0xdd, 0x3b, 0xfa, 0x04, 0xc0, 0x8b, 0x81, 0x7a, 0x89, - 0x6e, 0x44, 0xac, 0xda, 0x59, 0xb7, 0x73, 0x33, 0xfd, 0x98, 0x0a, 0x8c, 0x29, 0x8e, 0x31, 0x89, - 0xa4, 0xee, 0x18, 0x54, 0xab, 0xf2, 0x49, 0xe8, 0x10, 0x26, 0xbc, 0x22, 0x87, 0xa2, 0xc2, 0x0b, - 0xd5, 0xd2, 0xdc, 0x4b, 0x3d, 0xac, 0xfa, 0x76, 0xef, 0x39, 0xfd, 0x05, 0x40, 0xd4, 0x59, 0xb2, - 0x22, 0x33, 0x37, 0xb2, 0xe2, 0x46, 0x66, 0x6e, 0x74, 0x3d, 0xec, 0xe7, 0xd0, 0x51, 0x4d, 0xd4, - 0x6b, 0xed, 0xa0, 0xad, 0x9e, 0x1f, 0xe6, 0x57, 0x8e, 0xfe, 0x92, 0x62, 0x3f, 0x34, 0xa4, 0xd8, - 0x51, 0x43, 0x02, 0xc7, 0x0d, 0x09, 0xfc, 0xd9, 0x90, 0xc0, 0xe7, 0x27, 0x52, 0xec, 0xf8, 0x44, - 0x8a, 0xfd, 0x71, 0x22, 0xc5, 0xde, 0x9f, 0x0a, 0x34, 0xef, 0xcb, 0x36, 0xad, 0x3c, 0xf0, 0x5d, - 0x18, 0xda, 0x23, 0xcf, 0x15, 0xff, 0x37, 0xa9, 0x98, 0xe0, 0x7f, 0x02, 0xdd, 0xfa, 0x37, 0x00, - 0x00, 0xff, 0xff, 0x6b, 0x5f, 0x2f, 0xdf, 0xb4, 0x12, 0x00, 0x00, + 0x1b, 0xc7, 0x3d, 0xa9, 0xe3, 0x97, 0x69, 0xfa, 0xab, 0x3b, 0xbf, 0xd2, 0x18, 0x93, 0xae, 0xa3, + 0xa5, 0xa4, 0x69, 0x9a, 0xee, 0x92, 0x34, 0xa1, 0x80, 0x84, 0x50, 0x9c, 0x42, 0x93, 0x48, 0x91, + 0xd2, 0xad, 0x50, 0x25, 0x7a, 0xb0, 0xc6, 0xde, 0x89, 0xb3, 0x52, 0xbc, 0xeb, 0xec, 0x4c, 0x92, + 0x5a, 0x51, 0x00, 0x55, 0xe2, 0x86, 0x78, 0x11, 0xe2, 0xc0, 0x01, 0xc1, 0x01, 0x15, 0xce, 0x70, + 0x41, 0x5c, 0xb9, 0xe4, 0x18, 0x89, 0x0b, 0x27, 0x0b, 0x1c, 0x0e, 0x28, 0x7f, 0x42, 0x4f, 0x68, + 0x67, 0x67, 0x9c, 0x5d, 0xdb, 0x1b, 0x3b,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xaa, 0x8e, 0x49, 0x36, 0x65, 0x02, 0x8d, 0x76, 0x26, 0xd0, 0xaa, 0x37, 0x2e, + 0xb2, 0x45, 0x18, 0x0f, 0x4e, 0xa4, 0x87, 0x42, 0x23, 0x03, 0xef, 0x9e, 0x51, 0xa3, 0xab, 0x10, + 0x72, 0x1f, 0x45, 0x13, 0x33, 0xcc, 0x11, 0x46, 0x8c, 0x34, 0xff, 0x72, 0x17, 0x33, 0xac, 0xde, + 0x16, 0x91, 0x77, 0x2e, 0x2c, 0x22, 0x47, 0x30, 0xce, 0x67, 0x02, 0x3e, 0x93, 0x3f, 0xab, 0x5b, + 0x50, 0xe1, 0x93, 0x1e, 0x54, 0xb1, 0xcb, 0xce, 0xc8, 0x33, 0xdf, 0xc9, 0x53, 0xb8, 0xf2, 0xac, + 0x91, 0x47, 0x01, 0x82, 0x55, 0x42, 0xa9, 0xa7, 0x44, 0x80, 0x73, 0x15, 0xe6, 0x23, 0x5d, 0x0a, + 0xd2, 0xa9, 0x20, 0x69, 0xe4, 0x9a, 0x7e, 0x04, 0x37, 0x61, 0x46, 0xe4, 0x7e, 0xef, 0x13, 0xa7, + 0x7e, 0x33, 0x04, 0x33, 0x9e, 0x61, 0xe8, 0xa2, 0xbd, 0xd1, 0x66, 0x5d, 0xc8, 0x34, 0x1b, 0xf9, + 0x04, 0x37, 0xbb, 0x7b, 0xdc, 0xc8, 0x0f, 0x59, 0x66, 0xeb, 0xc4, 0x66, 0x61, 0xb2, 0xec, 0x12, + 0xcc, 0x1c, 0x97, 0xc7, 0x9b, 0x36, 0xe4, 0x2b, 0x7a, 0x0f, 0xa6, 0x3d, 0x9c, 0xe2, 0x06, 0xa6, + 0x1b, 0xd9, 0x73, 0x9c, 0xfb, 0xf5, 0x67, 0x8d, 0xfc, 0x5c, 0xc5, 0x62, 0x1b, 0xdb, 0x25, 0xad, + 0xec, 0x54, 0x75, 0x46, 0x6c, 0x93, 0xb8, 0x55, 0xcb, 0x66, 0xc1, 0xc7, 0x4d, 0xab, 0x44, 0xf5, + 0x52, 0x9d, 0x11, 0xaa, 0x2d, 0x91, 0xc7, 0x05, 0xef, 0xc1, 0x48, 0x79, 0x4b, 0x2d, 0x61, 0xba, + 0x81, 0x1e, 0xc1, 0x2b, 0x96, 0x4d, 0x19, 0xb6, 0x99, 0x85, 0x19, 0x29, 0xd6, 0xbc, 0x49, 0x94, + 0x7a, 0x29, 0x98, 0x88, 0xba, 0xf3, 0x17, 0xca, 0x65, 0x42, 0xe9, 0xa2, 0x63, 0xaf, 0x5b, 0x15, + 0x91, 0xc4, 0x2f, 0x04, 0xd6, 0x58, 0x6b, 0x2d, 0xe1, 0x5f, 0xfa, 0x2b, 0xf1, 0x54, 0x3c, 0x33, + 0xbc, 0x12, 0x4f, 0x0d, 0x67, 0x12, 0xea, 0x13, 0x00, 0x2f, 0x05, 0xd4, 0x14, 0x02, 0x2d, 0x7b, + 0xd7, 0x87, 0x27, 0x90, 0x57, 0x6b, 0x00, 0xf7, 0xab, 0x76, 0xbb, 0x76, 0xc3, 0xba, 0x16, 0x52, + 0xad, 0x5a, 0x93, 0x2a, 0x8b, 0x31, 0x34, 0x26, 0x76, 0xd6, 0xcf, 0x96, 0xd4, 0x71, 0x23, 0xcf, + 0xdf, 0xfd, 0xbd, 0x14, 0x55, 0xe8, 0x51, 0x80, 0x81, 0xca, 0x2d, 0x0d, 0x5f, 0x10, 0xe0, 0xb9, + 0x2f, 0x88, 0xa7, 0x00, 0xa2, 0xe0, 0xea, 0x22, 0xc4, 0x7b, 0x10, 0xb6, 0x42, 0x94, 0x37, 0x43, + 0x3f, 0x31, 0xfa, 0xfa, 0xa6, 0x65, 0x7c, 0x03, 0xbc, 0x27, 0x30, 0x1c, 0xe5, 0x9c, 0x6b, 0x96, + 0x6d, 0x13, 0xf3, 0x14, 0x2d, 0x9e, 0xff, 0xb2, 0xfc, 0x0c, 0x88, 0xb6, 0x25, 0xe4, 0xa3, 0x75, + 0x06, 0x53, 0xe2, 0x54, 0xf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9, + 0x7e, 0x4c, 0x05, 0xc6, 0x04, 0xc7, 0x18, 0x47, 0x4a, 0x77, 0x0c, 0xaa, 0xd7, 0xf8, 0x24, 0xb4, + 0x0f, 0x13, 0x7e, 0x4d, 0x43, 0x51, 0xe1, 0x85, 0x4a, 0x67, 0xee, 0x95, 0x1e, 0x56, 0x7d, 0xbb, + 0xf7, 0x9d, 0xfe, 0x02, 0x20, 0xea, 0xac, 0x50, 0x91, 0x99, 0x1b, 0x59, 0x60, 0x23, 0x33, 0x37, + 0xba, 0xfc, 0xf5, 0x73, 0xe8, 0xa8, 0x2e, 0xca, 0xb3, 0xbe, 0xd7, 0x56, 0xbe, 0xf7, 0x0b, 0x4b, + 0x07, 0x7f, 0x29, 0xb1, 0x1f, 0x9b, 0x4a, 0xec, 0xa0, 0xa9, 0x80, 0xc3, 0xa6, 0x02, 0xfe, 0x6c, + 0x2a, 0xe0, 0xf3, 0x23, 0x25, 0x76, 0x78, 0xa4, 0xc4, 0xfe, 0x38, 0x52, 0x62, 0xef, 0x4f, 0x04, + 0x7a, 0xf5, 0x45, 0x87, 0x56, 0x1f, 0x4a, 0x17, 0xa6, 0xfe, 0xd8, 0x77, 0xc5, 0xff, 0x3c, 0x2a, + 0x25, 0xf8, 0x7f, 0x3e, 0xb7, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x78, 0x46, 0xe1, 0xa8, 0xa3, + 0x12, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1101,6 +1224,7 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool { } return true } + func (this *CodeInfoResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1134,6 +1258,7 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool { } return true } + func (this *QueryCodeResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1332,39 +1457,48 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} +type UnimplementedQueryServer struct{} func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryContractInfoRequest) (*QueryContractInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") } + func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") } + func (*UnimplementedQueryServer) ContractsByCode(ctx context.Context, req *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractsByCode not implemented") } + func (*UnimplementedQueryServer) AllContractState(ctx context.Context, req *QueryAllContractStateRequest) (*QueryAllContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllContractState not implemented") } + func (*UnimplementedQueryServer) RawContractState(ctx context.Context, req *QueryRawContractStateRequest) (*QueryRawContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawContractState not implemented") } + func (*UnimplementedQueryServer) SmartContractState(ctx context.Context, req *QuerySmartContractStateRequest) (*QuerySmartContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SmartContractState not implemented") } + func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") } + func (*UnimplementedQueryServer) Codes(ctx context.Context, req *QueryCodesRequest) (*QueryCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") } + func (*UnimplementedQueryServer) PinnedCodes(ctx context.Context, req *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PinnedCodes not implemented") } + func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } + func (*UnimplementedQueryServer) ContractsByCreator(ctx context.Context, req *QueryContractsByCreatorRequest) (*QueryContractsByCreatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractsByCreator not implemented") } @@ -2518,11 +2652,11 @@ func (m *QueryContractsByCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int i-- dAtA[i] = 0x12 } - if len(m.ContractAddress) > 0 { - for iNdEx := len(m.ContractAddress) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ContractAddress[iNdEx]) - copy(dAtA[i:], m.ContractAddress[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress[iNdEx]))) + if len(m.ContractAddresses) > 0 { + for iNdEx := len(m.ContractAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ContractAddresses[iNdEx]) + copy(dAtA[i:], m.ContractAddresses[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddresses[iNdEx]))) i-- dAtA[i] = 0xa } @@ -2541,6 +2675,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } + func (m *QueryContractInfoRequest) Size() (n int) { if m == nil { return 0 @@ -2895,8 +3030,8 @@ func (m *QueryContractsByCreatorResponse) Size() (n int) { } var l int _ = l - if len(m.ContractAddress) > 0 { - for _, s := range m.ContractAddress { + if len(m.ContractAddresses) > 0 { + for _, s := range m.ContractAddresses { l = len(s) n += 1 + l + sovQuery(uint64(l)) } @@ -2911,9 +3046,11 @@ func (m *QueryContractsByCreatorResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } + func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } + func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2996,6 +3133,7 @@ func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3111,6 +3249,7 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3229,6 +3368,7 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3349,6 +3489,7 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3454,6 +3595,7 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3572,6 +3714,7 @@ func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3690,6 +3833,7 @@ func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3810,6 +3954,7 @@ func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3926,6 +4071,7 @@ func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4010,6 +4156,7 @@ func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4126,6 +4273,7 @@ func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4210,6 +4358,7 @@ func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4279,6 +4428,7 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4447,6 +4597,7 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4567,6 +4718,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4653,6 +4805,7 @@ func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4773,6 +4926,7 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4859,6 +5013,7 @@ func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5021,6 +5176,7 @@ func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5071,6 +5227,7 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5154,6 +5311,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCreatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5272,6 +5430,7 @@ func (m *QueryContractsByCreatorRequest) Unmarshal(dAtA []byte) error { } return nil } + func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5303,7 +5462,7 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddresses", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5331,7 +5490,7 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = append(m.ContractAddress, string(dAtA[iNdEx:postIndex])) + m.ContractAddresses = append(m.ContractAddresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { @@ -5390,6 +5549,7 @@ func (m *QueryContractsByCreatorResponse) Unmarshal(dAtA []byte) error { } return nil } + func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/query.pb.gw.go b/x/wasm/types/query.pb.gw.go index 865c0ad75f..53f5a0b4b2 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -20,18 +20,19 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) // Suppress "imported and not used" errors var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join + +var ( + _ io.Reader + _ status.Status + _ = runtime.String + _ = utilities.NewDoubleArray + _ = descriptor.ForMessage +) func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractInfoRequest @@ -57,7 +58,6 @@ func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.ContractInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,12 +84,9 @@ func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.M msg, err := server.ContractInfo(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractHistoryRequest @@ -122,7 +119,6 @@ func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -156,12 +152,9 @@ func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtim msg, err := server.ContractHistory(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCodeRequest @@ -194,7 +187,6 @@ func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractsByCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -228,12 +220,9 @@ func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtim msg, err := server.ContractsByCode(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllContractStateRequest @@ -266,7 +255,6 @@ func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.AllContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -300,7 +288,6 @@ func local_request_Query_AllContractState_0(ctx context.Context, marshaler runti msg, err := server.AllContractState(ctx, &protoReq) return msg, metadata, err - } func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -338,7 +325,6 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.RawContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -376,7 +362,6 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti msg, err := server.RawContractState(ctx, &protoReq) return msg, metadata, err - } func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -414,7 +399,6 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M msg, err := client.SmartContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -452,7 +436,6 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run msg, err := server.SmartContractState(ctx, &protoReq) return msg, metadata, err - } func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -479,7 +462,6 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -506,12 +488,9 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler msg, err := server.Code(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryCodesRequest @@ -526,7 +505,6 @@ func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, cli msg, err := client.Codes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -542,12 +520,9 @@ func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshale msg, err := server.Codes(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) +var filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryPinnedCodesRequest @@ -562,7 +537,6 @@ func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.PinnedCodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -578,7 +552,6 @@ func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Ma msg, err := server.PinnedCodes(ctx, &protoReq) return msg, metadata, err - } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -587,7 +560,6 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -596,12 +568,9 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err - } -var ( - filter_Query_ContractsByCreator_0 = &utilities.DoubleArray{Encoding: map[string]int{"creator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) +var filter_Query_ContractsByCreator_0 = &utilities.DoubleArray{Encoding: map[string]int{"creator_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCreatorRequest @@ -634,7 +603,6 @@ func request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.M msg, err := client.ContractsByCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err - } func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -668,20 +636,16 @@ func local_request_Query_ContractsByCreator_0(ctx context.Context, marshaler run msg, err := server.ContractsByCreator(ctx, &protoReq) return msg, metadata, err - } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -689,7 +653,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -697,14 +660,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -712,7 +672,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -720,14 +679,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -735,7 +691,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractsByCode_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -743,14 +698,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -758,7 +710,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_AllContractState_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -766,14 +717,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -781,7 +729,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_RawContractState_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -789,14 +736,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -804,7 +748,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SmartContractState_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -812,14 +755,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -827,7 +767,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -835,14 +774,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -850,7 +786,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -858,14 +793,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -873,7 +805,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_PinnedCodes_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -881,14 +812,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -896,7 +824,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -904,14 +831,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -919,7 +843,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractsByCreator_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -927,7 +850,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil @@ -970,7 +892,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -988,7 +909,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1008,7 +928,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1028,7 +947,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1048,7 +966,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1068,7 +985,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1088,7 +1004,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1108,7 +1023,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1128,7 +1042,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1148,7 +1061,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1168,7 +1080,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) mux.Handle("GET", pattern_Query_ContractsByCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -1188,7 +1099,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractsByCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - }) return nil From fd39267d8e98761dad65db888e409c67f2f3a9ff Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Thu, 6 Oct 2022 13:15:47 +0200 Subject: [PATCH 33/35] Comment why AbsoluteTxPositionLen makes sense --- x/wasm/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index c02fb09b63..6a32d2bcb0 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -602,7 +602,7 @@ func (k Keeper) addToContractCreatorSecondaryIndex(ctx sdk.Context, creatorAddre store.Set(types.GetContractByCreatorSecondaryIndexKey(creatorAddress, position.Bytes(), contractAddress), []byte{}) } -// IterateContractsByCreator iterates over all contracts with given creator address. +// IterateContractsByCreator iterates over all contracts with given creator address in order of creation time asc. func (k Keeper) IterateContractsByCreator(ctx sdk.Context, creator sdk.AccAddress, cb func(address sdk.AccAddress) bool) { prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), types.GetContractsByCreatorPrefix(creator)) for iter := prefixStore.Iterator(nil, nil); iter.Valid(); iter.Next() { From 5aa7d1cc12e43489a2c853817f413b1856b675a1 Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Thu, 6 Oct 2022 13:18:52 +0200 Subject: [PATCH 34/35] Migrate 1 to 2 --- x/wasm/keeper/migrate_test.go | 4 ++-- x/wasm/keeper/migrations.go | 4 ++-- x/wasm/module.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/wasm/keeper/migrate_test.go b/x/wasm/keeper/migrate_test.go index a6c5b8ddeb..3b762c49d0 100644 --- a/x/wasm/keeper/migrate_test.go +++ b/x/wasm/keeper/migrate_test.go @@ -12,7 +12,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm/types" ) -func TestMigrate2To3(t *testing.T) { +func TestMigrate1To2(t *testing.T) { ctx, keepers := CreateTestInput(t, false, AvailableCapabilities) wasmKeeper := keepers.WasmKeeper @@ -48,7 +48,7 @@ func TestMigrate2To3(t *testing.T) { // migrator migrator := NewMigrator(*wasmKeeper) - migrator.Migrate2to3(ctx) + migrator.Migrate1to2(ctx) // check new store var allContract []string diff --git a/x/wasm/keeper/migrations.go b/x/wasm/keeper/migrations.go index 9948a22633..ffb80cc2ed 100644 --- a/x/wasm/keeper/migrations.go +++ b/x/wasm/keeper/migrations.go @@ -16,8 +16,8 @@ func NewMigrator(keeper Keeper) Migrator { return Migrator{keeper: keeper} } -// Migrate2to3 migrates from version 2 to 3. -func (m Migrator) Migrate2to3(ctx sdk.Context) error { +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { m.keeper.IterateContractInfo(ctx, func(contractAddr sdk.AccAddress, contractInfo types.ContractInfo) bool { creator := sdk.MustAccAddressFromBech32(contractInfo.Creator) m.keeper.addToContractCreatorSecondaryIndex(ctx, creator, contractInfo.Created, contractAddr) diff --git a/x/wasm/module.go b/x/wasm/module.go index 5bee3bbc17..2aa0c43147 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -136,7 +136,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), NewQuerier(am.keeper)) m := keeper.NewMigrator(*am.keeper) - err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3) + err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) if err != nil { panic(err) } From 52ee67545182b95c08dca4c7526ab2536bbc895a Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Thu, 6 Oct 2022 13:38:05 +0200 Subject: [PATCH 35/35] Set module version --- x/wasm/module.go | 2 +- x/wasm/module_integration_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/wasm/module.go b/x/wasm/module.go index 52082fc7a0..2aa0c43147 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -111,7 +111,7 @@ type AppModule struct { // module. It should be incremented on each consensus-breaking change // introduced by the module. To avoid wrong/empty versions, the initial version // should be set to 1. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return 2 } // NewAppModule creates a new AppModule object func NewAppModule( diff --git a/x/wasm/module_integration_test.go b/x/wasm/module_integration_test.go index 0cbec6641f..bdce6cf34f 100644 --- a/x/wasm/module_integration_test.go +++ b/x/wasm/module_integration_test.go @@ -27,5 +27,5 @@ func TestModuleMigrations(t *testing.T) { gotVM, err := wasmApp.ModuleManager().RunMigrations(ctx, wasmApp.ModuleConfigurator(), fromVM) // then require.NoError(t, err) - assert.Equal(t, uint64(1), gotVM[wasm.ModuleName]) + assert.Equal(t, uint64(2), gotVM[wasm.ModuleName]) }